SCJP试题-SCJPMockExam3

来源:java认证发布时间:2012-11-12 12:48:16java认证视频



Question 51)
Given the following code what will be the output?class ValHold{
public int i = 10;
}

public class ObParm{
public static void main(String argv[]){
ObParm o = new ObParm();
o.amethod();
}
public void amethod(){
int i = 99;
ValHold v = new ValHold();
v.i=30;
another(v,i);
System.out.println(v.i);
}//End of amethod

public void another(ValHold v, int i){
i=0;
v.i = 20;
ValHold vh = new ValHold();
v = vh;
System.out.println(v.i+ " "+i);
}//End of another

}
1) 10,0, 302) 20,0,303) 20,99,304) 10,0,20
Answer
to Question 51)
--------------------------------------------------------------------------------

Question 52)
Given the following class definition, which of the following methods could be
legally placed after the comment//Here
public class Rid{
public void amethod(int i, String s){}
//Here
}
1)public void amethod(String s, int i){}2)public int amethod(int i,
String s){} 3)public void amethod(int i, String mystring){} 4) public
void Amethod(int i, String s) {}
Answer
to Question 52)
--------------------------------------------------------------------------------

Question 53)
Given the following class definition which of the following can be legally
placed after the comment line//Here ?class Base{
public Base(int i){}
}



public class MyOver extends Base{
public static void main(String arg[]){
MyOver m = new MyOver(10);
}
MyOver(int i){
super(i);
}

MyOver(String s, int i){
this(i);
//Here
}
}
1)MyOver m = new MyOver();2)super(); 3)this("Hello",10);4)Base b
= new Base(10);
Answer
to Question 53)
--------------------------------------------------------------------------------

Question 54)
Given the following class definition, which of the following statements would
be legal after the comment //Hereclass InOut{

String s= new String("Between");
public void amethod(final int iArgs){
int iam;
class Bicycle{
public void sayHello(){
//Here
}//End of bicycle class
}
}//End of amethod
public void another(){
int iOther;
}

}
1)System.out.println(s); 2) System.out.println(iOther);3)
System.out.println(iam);4) System.out.println(iArgs);
Answer
to Question 54)
--------------------------------------------------------------------------------

Question 55)
Which of the following are methods of the Thread class?
1) yield()2) sleep(long msec)3) go()4) stop()
Answer
to Question 55)
--------------------------------------------------------------------------------

Question 56)
Which of the following methods are members of the Vector class and allow you
to input a new element
1) addElement2) insert3) append4) addItem
Answer
to Question 56)
--------------------------------------------------------------------------------

Question 57)
Which of the following statements are true?
1) Adding more classes via import statements will cause a performance
overhead, only import classes you actually use.2) Under no circumstances can
a class be defined with the private modifier3) A inner class may
under some circumstances be defined with the protected modifier4) An
interface cannot be instantiated
Answer
57)
--------------------------------------------------------------------------------

Question 58)
Which of the following are correct event handling methods
1) mousePressed(MouseEvent e){}2) MousePressed(MouseClick e){}3)
functionKey(KeyPress k){}4) componentAdded(ContainerEvent e){}
Answer
58)
--------------------------------------------------------------------------------

Question 59)
Which of the following are methods of the Collection interface?1)
iterator2) isEmpty3) toArray4) setText
Answer
59)
--------------------------------------------------------------------------------

Question 60)
Which of the following best describes the use of the synhronized keyword?
1) Allows two process to run in paralell but to communicate with each
other2) Ensures only one thread at a time may access a method or
object3) Ensures that two or more processes will start and end at the same
time4) Ensures that two or more Threads will start and end at the same
time
Answer
60)

视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答