• 2022-06-18
    阅读下面的程序,分析代码是否能编译通过,如果能编译通过,选正确。如果不能编译通过,选错误。 public class A extends Thread{ protected void run() { System.out.println("thisisrun()"); } public static void main(String[] args) { A a = new A(); a.start(); } }
  • 举一反三

    内容

    • 0

      阅读下面的程序, 分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。 否则请说明编译失败的原因。class A {private int secret = 5;}public class Test1 {public static void main(String[] args) {A a = new A();System.out.println(a.secret++);}}

    • 1

      阅读下面的程序,分析代码是否能编译通过,如果能编译通过,请列出运行的结果。如果不能编译通过,请说明原因。代码一:class Program01{static void Main(string[] args){string s = new string('a', 5);s[3] = 'b';}}

    • 2

      程序分析题。阅读下面的程序,分析代码是否能编译通过,如果能编译通过,请列出运行的结果。如果不能编译通过,请说明原因。public class A {public static void main(String[] args) {System.out.println(Math.abs(-5));System.out.println(Math.ceil(6.6));System.out.println(Math.floor(-7.8));System.out.println(Math.round(-4.9));System.out.println(Math.max(8.1, -8.1));System.out.println(Math.min(6.1, -6.1));}}

    • 3

      阅读下面的程序,分析代码是否能编译通过,如果能编译通过,请列出运行的结果。如果不能编译通过,请说明原因。代码三:class Program03{static void Main(string[] args){StringBuilder sb = new StringBuilder("aaaaa");String s = sb;}}

    • 4

      阅读下面的程序, 分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。 否则请说明编译失败的原因。public class Test2 {int x = 50;static int y =200 ;public static void method() {System.out.println(x+y);}public static void main(String[] args) {Test2.method();}}