public class E4_1{ public static void main(String args[]) { int a = 1; int b = 2; int c = 3; a += 5; b *= 4; c += a * b; c %= 6; System.out.println("a = " + a); //代码1 System.out.println("b = " + b); //代码2 System.out.println("c = " + c); //代码3 }}运行结果,代码1______ ,代码2______ ,代码3______ 。
举一反三
- 阅读以下程序,请写出代码1和代码2的运行结果 public class App3_1{ public static void main(String args[]) { int a=155; float b=20.0f; System.out.println("a="+a+",b="+b); //代码1 System.out.println("a/b="+(a/b)); //代码2 } }
- 说出下列B类中【代码1】,【代码2】的输出结果 class A { public int getNumber(int a) { return a+1; } } class B extends A { public int getNumber (int a) { return a+100; } public static void main (String args[]) { A a =new A(); System.out.println(a.getNumber(10)); //【代码1】 a = new B(); System.out.println(a.getNumber(10)); //【代码2】 } }
- 写出以下程序的运行结果public class E4_1{ public static void main(String args[]) { int a = 1; int b = 2; int c = 3; a += 5; b *= 4; c += a * b; c %= 6; System.out.println("a = " + a); System.out.println("b = " + b); System.out.println("c = " + c); }}a=______ ,b=______ ,c=______ .
- 4、下列代码的输出结果是()。public class Example{public static void main(String args[]){int a=1;int b=a++;int c=++a;System.out.println( "a=" + a);System.out.println( "b=" + b);System.out.println( "c=" + c);}} A: a=2b=1c=3 B: a=3b=1c=2 C: a=3b=2c=3 D: a=3b=1c=3
- (6-7)下面代码段属于普通构造块。 class Block{ {//代码1 System.out.println("1"); } static{//代码2 System.out.println("2"); } {//代码3 System.out.println("3"); } public Block() {//代码4 System.out.println("4"); } }