题目内容

下面程序的运行结果为?public static void main(String[ ] args ) {int x = 30;int [ ] numbers = new int[x];x = 60;System.out.println(numbers.length ) ;}()

A. 30
B. 60
C. 20
D. 50

查看答案
更多问题

下列代码执行结果是()public class Rectangle {public int width = 3;public int height = 4;public int area(){return width * height;}public static void main(String args[]) {Rectangle rec

A. 15
B. 有编译错误,程序不能运行
C. 12
D. 0

在Java中,下面对于构造方法的描述正确的是()

A. 类必须显式定义构造方法
B. 构造方法的返回类型是void
C. 构造方法和类有相同的名称,并且不能带任何形参
D. 一个类可以定义多个构造方法

下面程序段的运行结果是()public static void main(String[] args) {String str = “null”;if (str == null) {System.out.println(“null”);}else if (str.length()== 0) {System.out.println(“zero”);

B. zero
C. some
D. Compilation fails

下列程序的运行结果是()。public class Animal {static int a[ ]=new int[10];public static void main(String args ) {System.out.println(a[9]);}}

A. 输出零
B. 编译时正确,运行时将产生错误
C. 输出空
D. 编译时将产生错误

答案查题题库