编译运行如下Java代码,输出结果是____________。public class Test{ public static void main(String[] args){ int num = 5; if (num <= 5){ num += 2; System.out.print(num); } System.out.print(num+5);
A. 10
B. 5 10
C. 7 12
D. 运行出错
查看答案
数组元素通过( )来访问。
A. 数组名
B. 下标
C. 数组名[下标]
D. int[ ]
在Java中,下列( )不是合法的变量名。
A. _myString
B. $ab
C. myString
D. 9myString
运行下面这段代码的结果为________________。int day = 3;switch(day){ case 1: case 3: case 5: System.out.print("学钢琴!"); break; case 2: System.out.print("学英语!"); default: System.out.print("去必胜客吃饭!");}
A. 学钢琴!
B. 学钢琴!学英语!
C. 学钢琴!去必胜客吃饭!
D. 没有任何输出
将以下哪种方法插入到第6行是不合法的( ) 。1.public class Test1 { 2. public float aMethod(float a,float b) throws 3. IOException { } 4. } 5.public class Test2 extends Test1{ 6. 7.}
A. float aMethod(float a,float b){ }
B. public int aMethod(int a,int b)throws Exception{ }
C. public float aMethod(float p,float q){ }
D. public int aMethod(int a,int b)throws IOException{ }