仔细阅读程序,确定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 static void main(String[] args){int x=200,y=-10,z=300;if(x<;y)if(y<;0) z=-z;else z+=10;System.out.println(z);} A: 0 B: -300 C: 200 D: 300
- 以下程序的输出结果为: 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); } }
- 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
- 写出下面程序运行结果。 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); } }
- 执行下列程序,输出结果为()。 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); } }