SCJP试题-SCJPMockExam4
百度广告
1) float f=1.3;
3) byte b=257;
5) int i=10;
Question 2)
public class MyClass {
amethod(arguments);
public void amethod(String arguments) {
System.out.println(arguments[1]);
}
2) error method main not correct
4) amethod must be declared with String
Answer to Question 2
Question 3)
1)
import java.awt.*;
class Myclass {}
package MyPackage;
class MyClass{}
/*This is a comment */
package MyPackage;
class MyClass{}
Answer to Question 3
Question 4)
1) -128 to 127
3) -255 to 256
Answer to Question 4
Question 5)
java myprog good morning
public static void main(String argv)
System.out.println(argv)
}
2) good
4) Exception raised: "java.lang.ArrayIndexOutOfBoundsException: 2"
Question 6)
1) if
3) goto
5) case
Answer to Question 6
Question 7)
1) 2variable
3) _whatavariable
5) $anothervar
Answer to Question 7
Question 8)
static int i;
System.out.println(i);
}
2) null
4) 0
Answer to Question 8
Question 9)
public class Q {
int anar=new int{1,2,3};
}
1) 1
3) 2
Question 10)
What will happen if you try to compile and run the following code?
public class Q {
int anar=new int;
}
1) Error: anar is referenced before it is initialized
3) 0
Answer to Question 10
Question 11)
What will be the result of attempting to compile and run the following code?
abstract class MineBase {
static int i;
public class Mine extends MineBase {
int ar=new int;
System.out.println(ar[i]);
}
2) Error: ar is used before it is initialized
4) IndexOutOfBoundes Error
Answer to Question 11
Question 12)
int i=1;
case 0:
break;
System.out.println("one");
System.out.println("two");
System.out.println("default");
1) one
3) one, two, default
Answer to Question 12
Question 13)
int i=9;
default:
case 0:
break;
System.out.println("one");
System.out.println("two");
1) default
3) error default clause not defined
Answer to Question 13
Question 14)
1)
int i=0;
System.out.println("Hello");
2)
boolean b=true;
if(b==b2) {
}
int i=1;
if(i==1|| j==2)
4)
int i=1;
if(i==1 &| j==2)
System.out.println("OK");
Question 15)
no file called Hello.txt in the current directory?.
import java.io.*;
public static void main(String argv){
System.out.println(m.amethod());
public int amethod() {
FileInputStream dis=new FileInputStream("Hello.txt");
System.out.println("No such file found");
}catch(IOException ioe) {
System.out.println("Doing finally");
return 0;
}
2 No such file found ,-1
4) 0
Answer to Question 15
Question 16)
1) Methods cannot be overriden to be more private
3) Private methods cannot be overloaded
Answer to Question 16
Question 17)
class Base {}
class Sub2 extends Base {}
public static void main(String argv){
Sub s=(Sub) b;
}
2) Compile time Exception
Question 18)
1) System.out.println( -1 >>> 2);will output a result larger than 10
>> 2); will output a positive number
> 1); will output the number 1
4) System.out.println( 1
编辑推荐:
温馨提示:因考试政策、内容不断变化与调整,长理培训网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准! (责任编辑:长理培训)
-
国家电网30270试题
-
湖南中烟7463试题
-
湖南统招专升本不连网,流畅做题
-
长沙理工大学考研培训4532试题
已有 22658 名学员学习以下课程通过考试
精品课程
更多- 电网书籍
- 财会书籍
- 其它工学书籍
- 电气拼团课程
- 财会拼团课程
- 其它工学拼团
-
- 长理培训微信公众号
- 每日推送精彩考试资讯
长按二维码识别
微信搜索“ 长理培训”
-
- 加入QQ群一起来考国网!
- QQ群号:223940140
点击进入
长理培训客户端 资讯,试题,视频一手掌握
去 App Store 免费下载 iOS 客户端
点击加载更多评论>>