举一反三
- 阅读下面的程序, 分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。 否则请说明编译失败的原因。class A {private int secret = 5;}public class Test1 {public static void main(String[] args) {A a = new A();System.out.println(a.secret++);}}
- 阅读下面的程序,分析代码是否能够编译通过,答案填“通过”或“不通过”class A { private int secret = 5;}public class Test1 { public static void main(String[] args) { A a = new A(); System.out.println(a.secret++); }}
- 阅读下面的程序,分析代码是否能够编译通过(能通过选“正确”,不能通过选“错误”) class A { private int secret = 5; } public class Test1 { public static void main(String[] args) { A a = new A(); System.out.println(a.secret++); } }
- 阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。否则请说明编译失败的原因。 class Test{ int a = 10; public static void main(String[] args){ int a= 20; System.out.println("a = "+ a); } }
- 阅读下面的程序,分析代码是否能够编译通过,答案填“通过”或“不通过”class A { private int secret = 5;}public class Test1 { public static void main(String[] args) { A a = new A____; System.out.println(a.secret++); 学生答案:
内容
- 0
阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。否则请说明编译失败的原因。 class Test2 { int x = 50; static int y = 200; public static void Method() { Console.WriteLine(x + y); } } class Program { public static void Main(string[] args) { Test2.Method(); } }
- 1
阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。否则请说明编译失败的原因。代码一:public class Test01 {public static void Main(string[] args){byte b = 3;b = b + 4;Console.WriteLine("b=" + b);}}
- 2
阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。否则请说明编译失败的原因。 public class Demo { public static void main(String[] args) { new Object(){ public void show(){ System.out.println("helloworld"); } }.show(); } }
- 3
阅读下面的程序,分析代码是否能编译通过,如果能编译通过,请列出运行的结果。如果不能编译通过,请说明原因。代码一:class Program01{static void Main(string[] args){string s = new string('a', 5);s[3] = 'b';}}
- 4
下面的程序没有编译错误,运行结果为:5。 class A { private int secret = 5; } public class Test1 { public static void main(String[] args) { A a = new A(); System.out.println(a.secret++); } }