/**
*
* @author yaoyuan
*/
12 public class Certkiller5{
13 public static void main(String[] yahoo){
14 for(int x=1;x<yahoo.length;x++){
15 System.out.print(yahoo[x] + " ");
16 }
17 }
18 }
19
/**
*and the command and line invocation java Certkiller5 a b c, What is the result?
*
*
*
*A a b
*B b c
*C a b c
*D Compilation fails
*E An exception is thrown at runtime
*/
// Answer : B
/**
* 注意14行的,x的值
*
*/
/**
*
* @author yaoyuan
*/
11 public static void certkiller(String str){
12 int check = 4;
13 if(chect = str.length()){
14 System.out.print(str.charAt(check = 1) + "");
15 }else{
16 System.out.print(str.charAt(0) + "");
17 }
18 }
and the invocation:
13 certkiller("four");
14 certkiller("tee");
15 certkiller("to");
/**
*What is the result?
*
*
*
*A r,t,t
*B r,e,o
*C Compilation fails
*D An exception is thrown at runtime
*/
// Answer : C
/**
*
* @author yaoyuan
*/
11 public class Certkiller{
12 public static void main(String[] args){
13 String myProp = /*insert code here*/
14 System.out.println(myProp);
15
16
/**
*and the command line:
*java -D rop.custom = gobstopperCertkiller
*Which two placed on line 13, will produce the output gobstopper?(choose two)
*
*
*A System.load("prop,custom");
*B System.getenv("prop.custom");
*C System.property("prop.custom");
*D System.getProperty("prop.custom");
*E System.getProperties().getProperty("prop.custom");
*/
// Answer : D E
/**
*
* @author yaoyuan
*/
1package util;
2public class BitUtils{
3 public static void process(byte []){/*more code here*/}
4}
1package app;
2public class CertkillerApp{
3 public static void main(String[] args){
4 byte[] bytes = new byte[256];
5 //insert code here
6 }
7}
/**
*What is required at line 5 in class CertkillerApp to use the process method of BitUtils?
*
*
*
*A Process(bytes);
*B BitUtils.process(bytes);
*C Util.BitUtils.process(bytes);
*D CertkillerApp cannot use method in BitUtils
*E Import util.BitUtils.*; process(bytes);
*/
// Answer : C
/**
*
* @author yaoyuan
*/
public class Item{
private String desc;
public String getDescription(){
return desc;
}
public void setDescription(String d){
desc = 1;
}
public static void modifyDesc(Item item, String desc){
item = new Item();
item.setDescription(desc);
}
public static void main(String[] args){
Item it = new Item();
it.setDescription("Gobstopper");
Item it2 = new Item();
it2.setDescription("Fizzylifting");
modifyDesc(it, "Scrumdiddlyumptious");
System.out.println(it.getDescription());
System.out.println(it2.getDescription());
}
}
/**
*What is the out come of the code?
*
*
*A Compilation fails
*B Gobstopper
* Fizzylifting
*C Gobstopper
* Scrumdiddlyumptious
*D Scrumdiddlyumptious
* Fizzylifting
*E Scrumdiddlyumptious
* Scrumdiddlyumptious
*/
// Answer : B
/**
*
* @author yaoyuan
*/
class CertKiller1{
public CertKiller1(){
System.out.print(1);
}
}
class CertKiller2 extends CertKiller1{
public CertKiller2(){
System.out.print(2);
}
}
class CertKiller3 extends CertKiller2{
public CertKiller3(){
System.out.print(3);
}
}
public class Numbers{
public static void main(String[] args){
new CertKiller3();
}
}
/**
*What is the result when this code executed?
*
*
*A 1
*B 3
*C 123
*D 321
*E The code runs with no output
*/
// Answer : C
/**
*
* @author yaoyuan
*/
/**
*Place the code fragments in position to complete the Displayable interface.
*/
interface Reloadable{
public void reload();
}
class Edit{
public void edit(){
/* Edit Here*/
}
}
interface Displayable [place here] [place here]{
[place here]
}
}
/**
* Code Fragments
*
* extends public void display(); Reloadable
* implements public void display();/"Display"/}; Edit
*/
// Answer :
// interface Displayable extends Reloadable{
// public void display();
// }
/**
*
* @author yaoyuan
*/
class CertKiller{
public enum Direction{
NORTH,SOUTH,EAST,WEST
}
public class Sprite{
14 //insert code here
}
}
/**
*Which code ,inserted at line 14, allows the Sprite class to compile?
*
*
*A Direction d = NORTH
*B CertKiller.Direction = NORTH
*C Direction = Direction.NORTH
*D CertKiller.Direction d = CertKiller Direction.NORTH
*/
// Answer : D
/**
*
* @author yaoyuan
*/
10interface Foo{
11 int bar();
12}
13
14public class Beta{
15
16 class A implements Foo{
17 public int bar(){return 1;}
18 }
19
20 public int fubar(Foo foo){return foo.bar();}
21
22 public void testFoo(){
23
24 class A implements Foo{
25 public int bar(){return 2;}
26 }
27
28 System.out.println(fubar(new A();));
29 }
30
31 public static void main(String[] argv){
32 new Beta.testFoo();
33 }
34}
/**
*Which three statements are true?(choose three)
*
*
*A Compilation fails
*B The code compiles and the output is 2
*C If lines 16, 17 and 18 were removed, compilation would fail
*D If lines 24,25 and 26 were removed, compilation would fail.
*E If lines 16 ,17 and 18 were removed, the code would compiled and the output would be 2
*F If lines 24, 25 and 26 were removed, the code would compiled and the output would be 1
*/
// Answer : B E F
/**
*
* @author yaoyuan
*/
/**
*Add methods to the Bate class to make it compile correctly
*/
class Alpha{
public void bar(int...x){}
public void bar(int x){}
}
public class Beta extends Alpha{
[place here]
[place here]
[place here]
}
/**
* Methods
*
* private void bar(int x){} public void bar(int x){}
* public int bar(String x){return 1;} public Alpha bar(int x){}
* public void bar(int x, int y){} public int bar(int x){return x}
*/
// Answer :
// public class Beta extends Alpha{
// public void bar(int x, int y){}
// public int bar(String x){return 1;}
// public void bar(int x){}
// }
//
//
分享到:
- 2008-11-17 09:29
- 浏览 1486
- 评论(0)
- 论坛回复 / 浏览 (0 / 1669)
- 查看更多
相关推荐
scjp认证试题.rar
scjp模拟试题 scjp模拟试题(一) scjp模拟试题(二) scjp模拟试题(三) CSTP真题.pdf
Java scjp认证考试非常重要的题库,很有用的,
SCJP认证试题,精典
试题,能通过的就去试试吧!scjp试题 java认证考证,最基础的哦!
SCJP认证套题解析 SCJP认证套题解析 SCJP认证套题解析
JAVA认证-scjp模拟试题
JAVA认证历年真题 SCJP认证套题60题 含答案和解析
JAVA认证 scjp模拟试题。。。。
JAVA国际认证(SCJP)典型试题1000例,我花了5个大洋买的电子版,现在上传供各位想考SCJP认证的孩子学习,里面例题由简单到难的。
SUN认证的 scjp模拟试题(一),有意向的可以试试
参加sl-275课程培训时老师给的试题 85%以上的覆盖率 这是scjp1.5的试题 它和scjp1.6的试题基本一样
JAVA初级认证考试试题SCJP JAVA初级认证考试试题SCJP
Java国际认证(SCJP)典型试题1000例 高清版 pdf 作者: 施铮 出版社: 电子科技大学出版社 出版年: 2005-8 页数: 493 ISBN: 9787810948142
Java国际认证(SCJP)典型试题1000例(中文高清影印版)
Java国际认证(SCJP)典型试题1000例+(中文版)
JAVA认证-SCJP模拟试题(DOC 79页).rar JAVA认证-SCJP模拟试题(DOC 79页).rar
里面有三套模拟试题。sun公司sjcp认证