以下代码的编译运行结果为()。public class Test{public static void main(String[ ] args){int age;age = age + 1;System.out.println("The age is " + age);}}
A. 编译通过,运行无输出
B. 编译通过,运行输出:The age is 1
C. 编译通过,但运行时出错
D. 不能通过编译
查看答案
假设有以下代码:public class Test{long a[] = new long[10];public static void main(String[] args){System.out.println(a[6]);}}叙述正确的是()。
A. 输出null
B. 输出0
C. 出现编译错误
D. 运行出错
(专升本)在Java中,一切都是对象,类中包含两个部分,分别是变量和方法。类中定义的变量称为 。
在定义一个类的时候,如果类的成员被private所修饰,则该成员不能在类的外部被直接访问。
A. 对
B. 错
(1+X)以下使用 test() 方法的代码,哪一个是正确的( )?public int test(int num, String str){return num+ Integer.parseInt(str);}
A. test( "1", 2);
B. test();
C. test(1);
D. test(1,"2");