电话:0731-83595998
导航

非常不错的SCJP真题回忆

来源: 2017-12-13 15:23

 百度广告

PART 1
Boolean a=new Boolean; 
System.out.println(a[I]); } 
Compilation Error in Line 2 
Exception in Line 4 
Will print false 
Ans:F 
Integer b= new Integer(10); 
System.out.println(b.intvalue()); 
void Add(Integer b) 
int I= b.intvalue(); 
b= new Integer(I) 
What will be printed out? 
Will print 10 
String is not possible 
class 
Ans:b 
public static void main(String args) 
String a =args[1]; 
String c =args; 

the 'c' ? 
dog 
Compilation Error 
Ans:E 

Float c; 
float fl=4.2f; 

f.equls(d) 
c==d 
Ans:B,D 

System.out.println("s = "+s); 
what will be printed out? 
An Exception will occur 
Will print s= 
6. class s extends Thread{int j=0; 
try{Thread.sleep(5000);} 
j=100; 
public static void main(String args) 
s t1=new s(); 
System.out.println(t1.j); 

you have make t1 as Daemon Thread 
You have to suspend the main when the thread starts and resume it after 
You have to interrupt the main thread 
7. What will happen if you compile/run this code? 
2: { 
4: { 
6: 
8: } 
10: public static void main(String args) 
12: Q1 a = new Q1(); 
14: t.start();} 
||| 
B) Runtime exception at line 13. 
D) Prints "Before start of Thread " 
Ans:A 
int x=0,y=0; 
int addY(){y++; return y;} 

System.out.println(addX()+""+addY()); 
public static void main(String args) 
s run=new s(); 
Thread t2=new Thread(run); 
t2.start(); 

Will print in this order 11 22 33厖 
Will print in this order 12 3厖123厖 
Ans:C 
class s implements Runnable{ 
synchronized void addX(){x++; } 
void addXY(){x++;y++;} 
y)? true:false;) 

System.out.println(check()); } 
{ s run=new s(); 
Thread t2=new Thread(run); 
t2.start(); 

Select all that apply 
call addY() and addX() simultaneously for number of times in run() 
Ans:B,C 
A. init(); 
C. run(); 
Ans:B 
executing? 
B. stop(); 
D. wait(); 
F. notifyAll() 
Ans:EF 
12. class Outer{ 

Inner a= new Inner(); 
Outer o= new Outer();Outer.Inner a= new o.Inner(); 
Ans:CD 
A. Any variables in the enclosing scope 
C. Static variables declared in side the method 
Ans:D 
an Inner class can access all variables in the any enclosing scope 
an inner class can be declared as private 
an interface 
15. A ----- is a class that is a collection which cannot contain any 
SortedSet 
Sorted Map 
TreeSet 
16. What is true about Map select one 
A map will use unique key to store value 
Ans:C 
object, or null if the name has no parent part? 
getParentDir() 
parentDirectory() 
18. Which class should be used in situations that require writing 
LineNumberWriter 
PrintStream 
Ans:B 
new RandomAccessFile(f,"rw").writeByte(?; 
DataInputStream d=new DatainputStream(fis); 
FilterInputStream fis=new FilterInputStream(f,true); 
d.writeBytes(? 
DataOutputStream d=new DataOutputStream(fis); 

编辑推荐:

下载Word文档

温馨提示:因考试政策、内容不断变化与调整,长理培训网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准! (责任编辑:长理培训)

网络课程 新人注册送三重礼

已有 22658 名学员学习以下课程通过考试

网友评论(共0条评论)

请自觉遵守互联网相关政策法规,评论内容只代表网友观点!

最新评论

点击加载更多评论>>

精品课程

更多
10781人学习

免费试听更多

相关推荐
图书更多+
  • 电网书籍
  • 财会书籍
  • 其它工学书籍
拼团课程更多+
  • 电气拼团课程
  • 财会拼团课程
  • 其它工学拼团
热门排行

长理培训客户端 资讯,试题,视频一手掌握

去 App Store 免费下载 iOS 客户端