switch(today){
case '一','三','五'
System.out.println("包子");
case '二','四','六'
System.out.println("包子");
case '日'
System.out.println("吃主席套餐");
}
case '一','三','五'
System.out.println("包子");
case '二','四','六'
System.out.println("包子");
case '日'
System.out.println("吃主席套餐");
}
2015-08-05
只要你最终的结果能和他要求的一样,过程都无所谓.
double avg1=78.5;
int rise=5;
double avg2=(double)avg1+rise;
System.out.println("考试平均分:"+avg1);
System.out.println("调整后的平均分:"+(double)avg2);
double avg1=78.5;
int rise=5;
double avg2=(double)avg1+rise;
System.out.println("考试平均分:"+avg1);
System.out.println("调整后的平均分:"+(double)avg2);
2015-08-05
public class HelloWorld {
public static void main(String[] args) {
int age=25;
if(age>60){
System.out.println("老年");
}esle if(60>=age>=40){
System.out.println("中年");
}esle if(40>=age>=18){
System.out.println("少年");
}esle{
System.out.println("童年");
}
}
}
public static void main(String[] args) {
int age=25;
if(age>60){
System.out.println("老年");
}esle if(60>=age>=40){
System.out.println("中年");
}esle if(40>=age>=18){
System.out.println("少年");
}esle{
System.out.println("童年");
}
}
}
2015-08-05
for(;num>0;){
count++;
num/=10;
}
System.out.printf("它是个"+count+"位数!");
count++;
num/=10;
}
System.out.printf("它是个"+count+"位数!");
public class HelloWorld{
public static void main(String[] args) {
final String SEX="男";
final String NAME="高小迪";
System.out.println("用户的性别为:"+SEX);
System.out.println("用户的姓名为:"+NAME);
}
}
public static void main(String[] args) {
final String SEX="男";
final String NAME="高小迪";
System.out.println("用户的性别为:"+SEX);
System.out.println("用户的姓名为:"+NAME);
}
}
2015-08-04