1.枚举类型
由枚举替代循环条件
package javaclass;
public class lessontext {
private enum MyEnum{
One,Two,Three
}
public static void main(String[] args) {
for(MyEnum value:MyEnum.values()) {
System.out.println("SMALL");
}
}
}
2.运行时的同名屏蔽
package javaclass;
public class lessontext {
private static int val=1;
public static void main(String[] args) {
int val=2;
System.out.println("val="+val);
}
}
3.double的精度缺失
package javaclass;
public class lessontext {
public static void main(String[] args) {
System.out.println( "0.05+0.01="+(0.05+0.01));
System.out.println( "1.0-0.42="+( 1.0-0.42));
System.out.println( "4.015*100="+(4.015*100));
System.out.println( "123.3/100="+(123.3/100) );
}
}
4."+"号顺序导致输出不同
package javaclass;
public class lessontext {
public static void main(String[] args) {
int X=100;
int Y=200;
System.out.println("X+Y="+X+Y);
System.out.println(X+Y+"=X+Y");
}
}
标签:试题,--,System,第二周,static,println,100,public,out From: https://www.cnblogs.com/drz1145141919810/p/17703455.html