更多java基础知识试题
- 1以下代码打印到控制台的数字是多少 ?int[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9};for (int i = 0; i < 8; i++) { System.out.println(numbers[i]);}
- 2已知如下代码:1 class Example{2 String str;3 public Example(){4 str= "example";5 }6 public Example(String s){7 str=s;8 }9 }10 class Demo extends Example{11 }12 public class Test{13 public void f (){14 Example ex = new Example("Good");15 Demo d = new Demo("Good"); } }哪句语句会导致错误?
- 3在java中下列关于自动类型转换说法正确的是
- 416.设有下面两个类的定义:class Person { long id; // 身份证号String name; // 姓名 }class Student extends Person { int score; // 入学总分 int getScore(){return score; }}则类Person和类Student的关系是( )。
- 5Java语言具有许多优点和特点,哪个反映了Java程序并行机制的特点?( )