5. (单选题)Outer类中定义了一个成员内部类Inner,需要在main()方法中创建Inner类实例对象,以下四种方式哪一种是正确的?( )
A. Inner in = new Inner()
B. Inner in = new Outer.Inner();
C. Outer.Inner in = new Outer.Inner();
D. Outer.Inner in = new Outer().new Inner();
https://www.shititong.cn/cha-kan/shiti/0005e1b3-7b7a-56a0-c04c-ee30166b1a00.html
点击查看答案
11. (单选题)
关于下面的程序Test.java执行的结果是( )。
public class Test {
String x="1";
int y;
public static void main( ) {
int z=2;
System.out.println( );
}
}
A. 3
B. 102
C. 12
D. 程序有编译错误
https://www.shititong.cn/cha-kan/shiti/0005e1b4-86b7-ab20-c04c-ee30166b1a01.html
点击查看答案
7. (单选题)
应用程序的main方法中有以下语句,则输出的结果是( )。
int b[][]={{1}, {2,3}, {4,5,6}};
int sum=1;
for(int i=0;i<b.length-1;i++) {
for(int j=0;j<b[i].length-1;j++) {
sum*=b[i][j];
}
}
System.out.println( );
https://www.shititong.cn/cha-kan/shiti/0005e1b4-86b7-9f68-c04c-ee30166b1a00.html
点击查看答案
5 public class Teacher extends Person{
https://www.shititong.cn/cha-kan/shiti/0005e1b4-86b7-16b0-c04c-ee30166b1a06.html
点击查看答案
32. (单选题)
下面关于类的说法错误的是( )
A. 类中包含数据变量和方法
B. Java语言的类支持单继承和多继承
C. 类是Java语言中的一种复合数据类型
D. 类是对所有具有一定共性的对象的抽象
https://www.shititong.cn/cha-kan/shiti/0005e1b4-86b7-dde8-c04c-ee30166b1a01.html
点击查看答案
19. (单选题)对于下列Hello类,哪个叙述是正确的?
class Hello {
A. Hello类有2个构造方法。
B. Hello类的int Hello()方法是错误的方法。
C. Hello类没有构造方法。
D. Hello无法通过编译,因为其中的hello方法的方法头是错误的(没有类型)
https://www.shititong.cn/cha-kan/shiti/0005e1b4-86b7-35f0-c04c-ee30166b1a02.html
点击查看答案
24. (单选题)以下说法错误的是( )。
A. Java语言中允许一个类实现多个接口
B. Java语言中允许一个类继承多个类
C. Java语言中允许一个类同时继承一个类并实现一个接口
D. Java语言中允许一个接口继承一个接口
https://www.shititong.cn/cha-kan/shiti/0005e1b3-7b7a-79c8-c04c-ee30166b1a01.html
点击查看答案
24. (单选题)以下关于java类和接口的说法正确的是?
A. 一个类只能实现一个接口
B. 类只能单一继承
C. 类不能同时继承一个类和实现一个接口
D. 接口只允许单一继承
https://www.shititong.cn/cha-kan/shiti/0005e1b4-86b7-4978-c04c-ee30166b1a00.html
点击查看答案
18. (单选题)
类Test1定义如下:
public class Test1{
https://www.shititong.cn/cha-kan/shiti/0005e1b4-86b7-bac0-c04c-ee30166b1a01.html
点击查看答案
7. (单选题)设x=1,y=2,z=3,则表达式 y+=z--/++x的值是( )。
https://www.shititong.cn/cha-kan/shiti/0005e1b3-7b7a-1050-c04c-ee30166b1a00.html
点击查看答案