阅读下面程序 public class Increment{ public static void main( String args[] ) { int c; c=5; System.out.println(c); System.out.println(c++); System.out.println(c); } } 程序运行结果是______。
A: 5
B: 6
C: 6
D: 5
E: 5
F: 6
G: 6
H: 7
I: 7
J: 6
K: 6
L: 6
A: 5
B: 6
C: 6
D: 5
E: 5
F: 6
G: 6
H: 7
I: 7
J: 6
K: 6
L: 6
举一反三
- 写出以下程序的运行结果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=______ .
- 以下程序的运行结果是:( ) public class Increment{ public static void main(String args[]){ int c; c = 2; System.out.println(c); System.out.println(c++); System.out.println(c); } }
- 中国大学MOOC: 下列代码中构造方法的返回类型是()public class Village { Village () { System .out .println(“hiding in Village”) ; } public static void main( String args [ ]) { Village c =new Village ( ) ;}class Village { public static void main( String args [ ]) { Village c =new Village ( ) ; } Village () { System .out .println(“hiding in Village”) ; } }
- 以下程序的输出结果是() using System; class Program { public static void Main(string[] args) { int a=5,b=4,c=6,d; Console.WriteLine(“{0}”,d=a>b?(a>c?a:c):b); } } A: 5 B: 4 C: 6 D: 不确定
- 执行下列程序段后a和b的值为 class AB{ int a , b ; public void init(int x){ a = x ; int b = 5 ; } public void display(){ System.out.println("a = "+a+" b = "+b); } } public class ABTest{ public static void main(String[] args){ AB ab = new AB(); ab.init(6); ab.display() ; } } A: a = 5 b = 5 B: a = 0 b = 0 C: a = 6 b = 5 D: a = 6 b = 0