百度广告
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);
点击加载更多评论>>