class Test4 { public static void main(String [] args) { boolean x = true; boolean y = false; short z = 42; if((z++ = = 42) && (y = true)) z++; if((x = false) || (++z = = 45)) z++; System.out.println("z = " + z); } } 结果为:()
A: z = 42
B: z = 44
C: z = 45
D: z = 46
A: z = 42
B: z = 44
C: z = 45
D: z = 46
举一反三
- 现有:classTest4{publicstaticvoidmain(String[]args){booleanx=true;booleany=false;shortz=42;if((z++==42)&&(y=true))z++;if((x=false)||(++z==45))z++;System.out.println(¨z=”+z);}}结果为: A: z=42 B: z=44 C: z=45 D: z=46
- 仔细阅读程序,确定a,z的值? public class Example16{ public static void main(String[] args) { int x = 0; int y = 0; int z = 0; boolean a; a = x == 0 || z++ >1; System.out.println("a = " + a); System.out.println("z = " + z); } }
- 以下程序的输出结果为: public class test { public static void main(String args[]) { int x=1,y=1,z=1; if (x--==1&&y++==1||z++==1) System.out.println("x="+x+",y="+y+",z="+z); } }
- 执行下列程序,输出结果为()。 public class B{ public static void main(String[] args) { int x = 5; double y = 10.5f; float z = (float)(x*y); System.out.println(z); } }
- 写出下面程序运行结果。 public class Demo { public static void main(String args[]) { int x = 9, y = 11, z = 8; int t, w; t = x > y ? x : y + x; w = t > z ? t : z; System.out.println(w); } }