SCJP试题-SCJPMockExam2

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



Question 8)
Which of the following are valid statements

1) public class MyCalc extends Math
2) Math.max(s);
3) Math.round(9.99,1);
4)Math.mod(4,10);

Answer to Question 8)


--------------------------------------------------------------------------------

Question 9)
Which of the following are methods of the Runnable interface

1) run
2) start
3) yield
4) stop

Answer to Question 9)


--------------------------------------------------------------------------------

Question 10)
Which of the following statements are true?

1) A byte can represent between -128 to 127
2) A byte can represent between -127 to 128
3) A byte can represent between -256 to 256
4) A char can represent between -2x2 pow 16 2 x2 pow 16 - 1

Answer to Question 10)


--------------------------------------------------------------------------------

Question 11)
What will happen when you attempt to compile and run the following code
class Base{
public void Base(){
System.out.println("Base");
}
}
public class In extends Base{
public static void main(String argv[]){
In i=new In();
}
}

1) Compile time error Base is a keyword
2) Compilation and no output at runtime
3) Output of Base
4) Runtime error Base has no valid constructor

Answer to Question 11)


--------------------------------------------------------------------------------

Question 12)
You have a public class called myclass with the main method defined as follows

public static void main(String parm[]){
System.out.println(parm[0]);
}

If you attempt to compile the class and run the program as follows

java myclass hello

What will happen?

1) Compile time error, main is not correctly defined
2) Run time error, main is not correctly defined
3) Compilation and output of java
4) Compilation and output of hello

Answer to Question 12)


--------------------------------------------------------------------------------

Question 13)

Which of the following statements are true?

1) If a class has any abstract methods it must be declared abstract itself.
2) All methods in an abstract class must be declared as abstract
3) When applied to a class, the final modifier means it cannot be sub-classed
4) transient and volatile are Java modifiers

Answer to Question 13)

视频学习

我考网版权与免责声明

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

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

最近更新

社区交流

考试问答