niusouti.com

在如下源代码文件Test.java中, 哪个是正确的类定义?()A.public class test { public int x = 0; public test(int x) { this.x = x; } }B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }C.public class Test extends T1, T2 { public int x = 0; public Test (int x)

题目
在如下源代码文件Test.java中, 哪个是正确的类定义?()

A.public class test { public int x = 0; public test(int x) { this.x = x; } }

B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }

C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }

D.public class


相似考题
更多“在如下源代码文件Test.java中, 哪个是正确的类定义?() ”相关问题
  • 第1题:

    在下列源代码文件Test.java中,哪个选项是正确的类定义? ( )

    A.public class test { public int x=0; public test(int x) { this.x=x; } }

    B.public class Test { public int x=0; public Test(int x) { this.x=x; } }

    C.public class Test extends Ti,T2 { public int x=0; public Test(int x) { this.x=x; } }

    D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }


    正确答案:B

  • 第2题:

    如果有个Console类的源代码头定义如下,其完全限定类名的是()package cc.openhome; public class Console { ... }

    A.cc.openhome.Console

    B.package.cc.openhome.Console

    C.cc.openhome.class.Console

    D.以上皆非


    cn.nbcc.Console

  • 第3题:

    请问,使一个名为Myclass的public类可以成功编译,需满足以下哪个条件?

    A.Myclass类中必须定义一个正确的main()方法

    B.Myclass类必须定义在Myclass.java源文件中

    C.Myclass类必须定义在Myclass包中

    D.Myclass类必须被导入


    myclass类必须定义在myclass.java源文件中。

  • 第4题:

    使一个名为Myclass和public类可以成功编译,需满足以下哪个条件?

    A.Myclass类中必须定义一个正确的main()方法

    B.Myclass类必须定义在Myclass.java源文件中

    C.Myclass类必须定义在Myclass包中

    D.Myclass类必须被导入


    Myclass类必须定义在Myclass.java源文件中

  • 第5题:

    【判断题】Java的源代码中定义几个类,编译结果就生成几个以.class为后缀的字节码文件。()

    A.Y.是

    B.N.否


    java