{
try
{
throwMethod();
}
catch (IllegalAccessException e)
{
System.out.println("Caught " + e);
}
}
}
Choices:
What is the result when you compile and run the following code?
public class ThrowsDemo
{
static void throwMethod()
{
System.out.println("Inside throwMethod.");
throw new IllegalAccessException("demo");
}
public static void main(String args[])
{
try
{
throwMethod();
}
catch (IllegalAccessException e)
{
System.out.println("Caught " + e);
}
}
}
Choices:
A.Compilation error
B.Runtime error
C.Compile successfully, nothing is printed.
D.Inside throwMethod. followed by caught:java.lang.IllegalAccessExcption: demo
8:假定a和b为int型变量,则执行下述语句组后,b的值为
a=1;
b=10;
do
{
b-=a;
a++;
} while (b--<0);
A.9
B.-2
C.-1
D.8
9:
public class X{
public Object m(){
Object o = new Float(3.14F);//line 3
Object [] oa = new Object;//line 4
oa[0] = o;//line 5
o=null;//line 6
return oa[0];//line 7
}
}
When is the Float object, created in line 3,eligible for garbage collection?
public class X{
public Object m(){
Object o = new Float(3.14F);//line 3
Object [] oa = new Object;//line 4
oa[0] = o;//line 5
o=null;//line 6
return oa[0];//line 7
}
}
When is the Float object, created in line 3,eligible for garbage collection?
A.just after line 5.
B.just after line 6
C.just after line 7(that is,as the method returns)
D.never in this method
10:Math.round(-11.5)等於多少?
A.-11
B.-12
C.-11.5
D.none
11:In the following pieces of code, which one will compile without any error?
A.StringBuffer sb1 = "abcd";
B.Boolean b = new Boolean("abcd");
C.C: byte b = 255;
D.float fl = 1.2;
12:
Give the following method:
public void method( ){
String a,b;
a=new String(“hello world”);
b=new String(“game over”);
System.out.println(a+b+”ok”);
a=null;
a=b;
System.out.println(a);
}
In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection.
Give the following method:
public void method( ){
String a,b;
a=new String(“hello world”);
b=new String(“game over”);
System.out.println(a+b+”ok”);
a=null;
a=b;
System.out.println(a);
}
In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection.
A.before line 5
B.before line 6
C.before line 7
D.before line 9
13:
Give the following java class:
public class Example{
static int x[]=new int[15];
public static void main(String args[]){
System.out.println(x[5]);
}
}
Which statement is corrected?
Give the following java class:
public class Example{
static int x[]=new int[15];
public static void main(String args[]){
System.out.println(x[5]);
}
}
Which statement is corrected?
A.When compile, some error will occur.
2020年河北新闻网两学一做
时间:2023-09-18 07:0:242020年河北新闻网两学一做
时间:2023-09-15 11:0:59两学一做学习教育知
时间:2023-09-21 06:0:302020年开展两学一做学习教
时间:2023-09-19 21:0:30
和利时系统高级硬件工程师笔试题和面试题答案2023-09-14 05:51:53
新华信国际信息咨询JAVA工程师笔试题和面试题答案2023-09-18 13:10:37
陕西国际商贸学院在重庆高考专业招生计划(人数+代码)2025-05-22 10:38:12
安徽建筑大学和新余学院哪个好 分数线排名对比2025-05-22 10:36:54
襄阳职业技术学院广西录取分数线及招生人数 附-2020最低位次排名2025-05-22 10:35:29
长江大学和新疆师范大学哪个好 分数线排名对比2025-05-22 10:34:16
锦州师范高等专科学校在辽宁高考专业招生计划(人数+代码)2025-05-22 10:32:49
山东高考排名在17550的考生能报什么大学(原创)2025-05-22 10:31:33
广州华立学院的英语专业分数线(附2020-最低分排名怎么样)2025-05-22 10:30:14
兰州石化职业技术大学的理化测试与质检技术专业分数线(附2020-最低分排名怎么样)2025-05-22 10:29:06
泉州师范学院和亳州学院哪个好 分数线排名对比2025-05-22 10:27:53
贵州医科大学在江西高考专业招生计划(人数+代码)2025-05-22 10:26:23
东莞城市学院和西安工商学院哪个好 分数线排名对比2025-05-22 10:24:51
山东海事职业学院的水路运输安全管理专业分数线(附2020-最低分排名怎么样)2025-05-22 10:23:44 


