public class HelloWorld {
public static void main(String[] args) {
int score = 84;
String sex = "女";
if(score>=80){
if (sex.equals("男")){
System.out.println("进入男子组决赛");
}else{
System.out.println("进入女子组决赛"); }
}else{
System.out.println("淘汰");}}}
public static void main(String[] args) {
int score = 84;
String sex = "女";
if(score>=80){
if (sex.equals("男")){
System.out.println("进入男子组决赛");
}else{
System.out.println("进入女子组决赛"); }
}else{
System.out.println("淘汰");}}}
2015-08-16
public class HelloWorld {public static void main(String[] args) {
boolean a = true; // a同意
boolean b = false; // b反对
boolean c = false; // c反对
boolean d = true; // d同意
System.out.println((a&&b)+"未通过");
System.out.println((a||d)+"通过");
System.out.println((!a)+"未通过");
System.out.println((c^d)+"通过");}}
boolean a = true; // a同意
boolean b = false; // b反对
boolean c = false; // c反对
boolean d = true; // d同意
System.out.println((a&&b)+"未通过");
System.out.println((a||d)+"通过");
System.out.println((!a)+"未通过");
System.out.println((c^d)+"通过");}}
2015-08-16
public class qiweishen{
public static void main(String[] args){
int he=0;
for(int i=1;i<=100;i++){
if(i%3!=0){
he=he+i;
}
}
System.out.println("和为"+he);
}
}
public static void main(String[] args){
int he=0;
for(int i=1;i<=100;i++){
if(i%3!=0){
he=he+i;
}
}
System.out.println("和为"+he);
}
}
2015-08-15
String name="爱慕课"
char sex='男';
int num=18;
double price=120.5;
boodean isOK=true;
System.out.println(name);
System.out.println(sex);
System.out.println(num);
Sstem.out.println(price);
System.out.println(isOK);
char sex='男';
int num=18;
double price=120.5;
boodean isOK=true;
System.out.println(name);
System.out.println(sex);
System.out.println(num);
Sstem.out.println(price);
System.out.println(isOK);
2015-08-15
package zigong;
public class Shenweiqi{
public static void main(String[] args){
int he=0;
int oushu=2;
do{
he=he+oushu;
oushu=oushu+2;
}while(oushu<=50);
System.out.println("50以内的偶数之和为:"+he);
}
}
public class Shenweiqi{
public static void main(String[] args){
int he=0;
int oushu=2;
do{
he=he+oushu;
oushu=oushu+2;
}while(oushu<=50);
System.out.println("50以内的偶数之和为:"+he);
}
}
2015-08-15
public class HelloWorld {
public static void main(String[] args) {
int i = 1; // 代表 1 - 5 之间的数字
// 当变量小于等于 5 时执行循环
while (i<=5) {
// 输出变量的值,并且对变量加 1,以便于进行下次循环条件判断
System.out.println(i);
i++;
}
}
}
public static void main(String[] args) {
int i = 1; // 代表 1 - 5 之间的数字
// 当变量小于等于 5 时执行循环
while (i<=5) {
// 输出变量的值,并且对变量加 1,以便于进行下次循环条件判断
System.out.println(i);
i++;
}
}
}
2015-08-15
public class Shenweiqi {
public static void main(String[] args) {
int age=25;
if(age>60){
System.out.println("老年");
}else if(age>40){
System.out.println("中年");
}else if(age>18){
System.out.println("少年");
}else{
System.out.println("童年");
}
}
}
public static void main(String[] args) {
int age=25;
if(age>60){
System.out.println("老年");
}else if(age>40){
System.out.println("中年");
}else if(age>18){
System.out.println("少年");
}else{
System.out.println("童年");
}
}
}
2015-08-15
public class HelloWorld {
public static void main(String[] args) {
int age=25;
if(age>60){
System.out.println("老年");
}else if(18=<age<=40){
System.out.println("少年");
}else{
System.out.println("童年");
}
}
}
public static void main(String[] args) {
int age=25;
if(age>60){
System.out.println("老年");
}else if(18=<age<=40){
System.out.println("少年");
}else{
System.out.println("童年");
}
}
}
2015-08-15
public class HelloWorld {
public static void main(String[] args) {
int age=25;
if(age>=18){
System.out.println("成年");
}else{
System.out.println("未成年");
}
}
}
public static void main(String[] args) {
int age=25;
if(age>=18){
System.out.println("成年");
}else{
System.out.println("未成年");
}
}
}
2015-08-15
public class HelloWorld{
public static void main(String[] args) {
String a="我爱慕课网";
String b="www.imooc.com";
System.out.println(a+"\n"+b);
}
}
public static void main(String[] args) {
String a="我爱慕课网";
String b="www.imooc.com";
System.out.println(a+"\n"+b);
}
}
2015-08-15