| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 830 人关注过本帖
标题:[转载]SCJP认证套题解析
只看楼主 加入收藏
l54515429
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2005-12-22
收藏
 问题点数:0 回复次数:9 
[转载]SCJP认证套题解析

1. Which of the following range of short is correct?
   A. -27 -- 27-1

   B. 0 -- 216-1

   C. ?215 -- 215-1

   D. ?231 -- 231-1
   翻译下面哪些是short型的取值范围。

   答案 C

   解析 短整型的数据类型的长度是16 bits,有符号。另外需要说明的是java中所有的整(Integral)数(包括byte,short,int,long)全是有符号的。


   2. Which declarations of identifiers are legal?
   A. $persons

   B. TwoUsers

   C. *point

   D. this
   E. _endline
   翻译下面哪些是合法的标识符。

   答案 A,B,E

   解析 Java的标识符可以以一个Unicode字符,下滑线(_),美元符($)开始,后续字符可以是前面的符号和数字,没有长度限制,大小写敏感,不能是保留字。

   3. Which statement of assigning a long type variable to a hexadecimal value is correct?
   A. long number = 345L;

   B. long number = 0345;

   C. long number = 0345L;

   D. long number = 0x345L
   翻译哪些是将一个十六进制值赋值给一个long型变量。

   答案 D

   解析 十六进制数以0x开头,long型数以L(大小写均可,一般使用大写,因为小写的l和数字1不易区分)。

   4.Which of the following fragments might cause errors?
   A. String s = "Gone with the wind";
   String t = " good ";
   String k = s + t;

   B. String s = "Gone with the wind";
   String t;
   t = s[3] + "one";
   C. String s = "Gone with the wind";
   String standard = s.toUpperCase();

   D. String s = "home directory";
   String t = s - "directory";

   翻译下面的哪些程序片断可能导致错误。

   答案 B,D

   解析 
   A:String类型可以直接使用+进行连接运算。

   B:String是一种Object,而不是简单的字符数组,不能使用下标运算符取其值的某个元素,错误。

   C:toUpperCase()方法是String对象的一个方法,作用是将字符串的内容全部转换为大写并返回转换后的结果(String类型)。

   D:String类型不能进行减(-)运算,错误。

   5. Which are syntactically valid statement at// point x?
   class Person {
   private int a;
   public int change(int m){ return m; }
   }
   public class Teacher extends Person {
   public int b;
   public static void main(String arg[]){
   Person p = new Person();
   Teacher t = new Teacher();
   int i;

   // point x
   }
   }

   A. i = m;

   B. i = b;

   C. i = p.a;

   D. i = p.change(30);

   E. i = t.b.
   翻译在// point x处的哪些申明是句法上合法的。

   答案 D,E

   解析
   A:m没有被申明过,不能使用。

   B:虽然b是类Teacher的public成员变量,但是在静态方法中不能使用类中的非静态成员。

   C:a是类Person的private成员,在类外不能直接引用。

   D:change(int m)方法是public方法,并且返回一个int型值,可以通过类的实例变量p引用并赋值给一个int型变量。

   E:b是类Teacher的public成员变量,且是int型,可以通过类的实例变量t引用并赋值给一个int型变量。
6. Which layout manager is used when the frame is resized the buttons's position in the Frame might be changed?
   A. BorderLayout

   B. FlowLayout

   C. CardLayout

   D. GridLayout
   翻译当Frame的大小被改变时Frame中的按钮的位置可能被改变时使用的哪一个布局管理器。

   答案 B

   解析
   A:该布局管理器将容器划分为五个部分,容器大小的改变不会影响其中的组件的位置而是影响他们的大小。

   B:该布局管理器根据放入其中的组件的最合适大小调整组件的位置,根据组件放入的顺序安排,一行不能容纳时放入下一行,因此容器的大小改变可能改变组件的位置。

   C:该布局管理器显示放入该容器的当前页中的组件,一次显示一个,容器大小的改变不能影响其中组件的位置。

   D:该布局管理器将容器划分为固定的网格,组件加入后占据一个单元,各组件的相对位置不会因为容器的大小变化而变化,改变的只是组件的大小。

   7. Given the following code fragment:

   1) public void create() {
   2) Vector myVect;

   3) myVect = new Vector();

   4) }

   Which of the following statements are true?
   A. The declaration on line 2 does not allocate memory space for the variable myVect.

   B. The declaration on line 2 allocates memory space for a reference to a Vector object.

   C. The statement on line 2 creates an object of class Vector.

   D. The statement on line 3 creates an object of class Vector.

   E. The statement on line 3 allocates memory space for an object of class Vector
   翻译
   给出下面的代码片断。。。下面的哪些陈述为true(真)?
   A. 第二行的声明不会为变量myVect分配内存空间。
   B. 第二行的声明分配一个到Vector对象的引用的内存空间。
   C. 第二行语句创建一个Vector类对象。
   D. 第三行语句创建一个Vector类对象。
   E. 第三行语句为一个Vector类对象分配内存空间。

   答案 A,D,E

   解析
   SL-275中指出:要为一个新对象分配空间必须执行new Xxx()调用,new调用执行以下的操作:

   1.为新对象分配空间并将其成员初始化为0或者null。

   2.执行类体中的初始化。(例如在类中有一个成员声明int a=10;在第一步后a=0 ,执行到第二步后a=10)

   3.执行构造函数。

   4.变量被分配为一个到内存堆中的新对象的引用。

   8. Which of the following answer is correct to express the value 8 in octal number?
   A. 010

   B. 0x10

   C. 08

   D. 0x8
   翻译
   下面的哪些答案可以用以表示八进制值8。

   答案 A

   解析  八进制值以0开头,以0x开头的为十六进制值,八进制中不能出现数字8,最大只有7。

   9. Which are not Java keywords?
   A. TRUE

   B. sizeof

   C. const

   D. super
   E. void
   翻译
   哪些不是Java关键字。

   答案 A,B

   解析
   A:不是,Java中有true,但是这也不是关键字而是字面量(literal)。

   B:不是,Java中不需要这个操作符,所有的类型(原始类型)的大小都是固定的。

   C、D、E都是,需要说明的是const是java中未被使用的关键字。

   10. Which of the following statements are true?
   A. The equals() method determines if reference values refer to the same object.

   B. The == operator determines if the contents and type of two separate objects match.

   C. The equals() method returns true only when the contents of two objects match.

   D. The class File overrides equals() to return true if the contents and type of two separate objects match.
   翻译
   下面的哪些叙述为真。
   A. equals()方法判定引用值是否指向同一对象。

   B. == 操作符判定两个分立的对象的内容和类型是否一致。

   C. equals()方法只有在两个对象的内容一致时返回true。

   D. 类File重写方法equals()在两个分立的对象的内容和类型一致时返回true。

   答案 A,D

   解析 严格来说这个问题的答案是不确定的,因为equals()方法是可以被重载的,但是按照java语言的本意来说:如果没有重写(override)新类的equals(),则该方法和 == 操作符一样在两个变量指向同一对象时返回真,但是java推荐的是使用equals()方法来判断两个对象的内容是否一样,就像String类的equals()方法所做的那样:判定两个String对象的内容是否相同,而==操作符返回true的唯一条件是两个变量指向同一对象。从这个意义上来说选择给定的答案。从更严格的意义来说正确答案应该只有d。

11. Which statements about inheritance are true?
   A. In Java programming language only allows single inheritance.
   B. In Java programming language allows a class to implement only one
interface.
   C. In Java programming language a class cannot extend a class and implement
a interface together.
   D. In Java programming language single inheritance makes code more
reliable.
   翻译
   下面关于继承的哪些叙述是正确的。

   A.在java中只允许单一继承。

   B.在java中一个类只能实现一个接口。

   C.在java中一个类不能同时继承一个类和实现一个接口。

   D.java的单一继承使代码更可靠。

   答案 A,D

   解析 在java中一个类只能有一个直接父类,但是可以实现多个接口,在继承的同时可以实现接口,之所以取消多继承的原因是多继承使得代码产生很多问题,而使用单一继承则可以使代码更可靠。

   12.
   1) class Person {

   2) public void printValue(int i, int j) {/*…*/ }

   3) public void printValue(int i){/*...*/ }
   4) }

   5) public class Teacher extends Person {

   6) public void printValue() {/*...*/ }

   7) public void printValue(int i) {/*...*/}

   8) public static void main(String args[]){

   9) Person t = new Teacher();

   10) t.printValue(10);

   11) }

   12) }

   Which method will the statement on line 10 call?
   A. on line 2

   B. on line 3

   C. on line 6

   D. on line 7
   翻译
   第十行的声明将调用哪些方法。

   答案 D

   解析 变量t是一个Person对象,但是它是用Teacher实例化的,这个问题涉及到java的编译时多态和运行时多态的问题,就编译时多态来说,t实际上是一个Person类,这涉及到类型的自动转换(将一个子类的实例赋值给一个父类的变量是不用进行强制类型转换,反之则需要

进行强制类型转换,而且被赋值的变量实际上应该是一个子类的对象),如果对t调用了子类中新增的方法则造成编译时错误编译将不能通过,而在运行时,运行时系统将根据t实际指向的类型调用对应的方法,对于本例来说,t.print(10)将调用t实际指向的Teacher类的对应方法。在java中,可以用一个子类的实例实例化父类的一个变量,而变量在编译时是一个父类实例,在运行时可能是一个子类实例。

   13. Which are not Java primitive types?
   A. short

   B. Boolean

   C. unit

   D. float
   翻译
   下面哪些不是java的原始数据类型。

   答案 B,C

   解析 Java的原始数据类型一共就八个,分别是:byte,short,int,long,boolean,char,float,double。注意这些是大小写敏感的,而Boolean是booelan的封装类(wrapper class)。

   14. Use the operators "<<", ">>", which statements are true?
   A. 0000 0100 0000 0000 0000 0000 0000 0000<<5 gives

   1000 0000 0000 0000 0000 0000 0000 0000

   B. 0000 0100 0000 0000 0000 0000 0000 0000<<5 gives

   1111 1100 0000 0000 0000 0000 0000 0000

   C. 1100 0000 0000 0000 0000 0000 0000 0000>>5 gives

   1111 1110 0000 0000 0000 0000 0000 0000

   D. 1100 0000 0000 0000 0000 0000 0000 0000>>5 gives

   0000 0110 0000 0000 0000 0000 0000 0000
   翻译
   使用"<<"和 ">>"操作符的哪些陈述是对的。

   答案 A,C

   解析 Java的移位操作符一共有三种,分别是”>>”,”>>>”,”<<”,执行的操作分别是有符号右移,无符号右移,左移,有符号右移的意思是说移入的最高位和原最高符号位相同,无符号右移是移入位始终补零,左移时最低位始终补零,最高位被舍弃。移位操作符另一个非常值得注意的特点是其右操作数是取模运算的,意思是说对于一个int型数据而言,对它移位32位的结果是保持不变而非变成零,即:a>>32的结果是a而不是0,同理,对long型数是对右操作数取64的模,a>>64==a;还有一点需要注意的是移位操作符”>>>”只对int型和long型有效,对byte或者short的操作将导致自动类型转换,而且是带符号的。
15. Which of the following range of int is correct?
   A. -27 -- 27-1

   B. 0 -- 232-1

   C. ?215 -- 215-1

   D. ?231 -- 231-1
   翻译
   int的取值范围是哪个。

   答案 D

   解析 int型是32位的。参看第一题的论述。



16. Which keyword should be used to enable interaction with the lock of an
object? The flag allows exclusive access to that object.
   A. transient

   B. synchronized

   C. serialize

   D. static
   翻译
   下面的哪些关键字通常用来对对象的加锁,该标记使得对对象的访问是排他的

   答案 B

   解析 由于java是多线程的语言,多个线程可以”同时”访问同一数据区,而在处理某些数据时不希望其它的线程修改那些数据的值或者某些操作是不可打断的,要做到这个,可以使用synchronized关键字声明这一点。

   17. Which is the return type of the method main()?
   A. int

   B. void

   C. boolean

   D. static
   翻译
   main()方法的返回类型是什么?

   答案 B

   解析  在java中,程序运行的入口就是main()方法,它必须是这样的形式:public static void main(String args[])。但是严格来讲这个题目的答案还可以加上a和c,因为并

没有限定是程序入口的main()方法,而main()方法是可以重载的。一般意义上的main()当然就是指我们刚开始所说的main()方法了。

   18. Given the following code:

   if (x>0) { System.out.println("first"); }

   else if (x>-3) { System.out.println("second"); }

   else { System.out.println("third"); }

   Which range of x value would print the string "second"?
   A. x > 0

   B. x > -3

   C. x <= -3

   D. x <= 0 & x > -3
   翻译
   给出下面的代码:

   …

   x的取值在什么范围内时将打印字符串"second"。

   答案 D

   解析 x>0时打印"first",x>-3&&x<=0时打印"second",x<=-3时打印"third"。这个题目没有什么难的,只要理解if语句的语法就可以了。

搜索更多相关主题的帖子: SCJP short 解析 java identifiers 
2006-03-31 16:55
l54515429
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2005-12-22
收藏
得分:0 

19. Given the following expression about TextField which use a proportional
pitch font.
   TextField t = new TextField("they are good",40);

   Which statement is true?
   A. The displayed string can use multiple fonts.

   B. The maximum number of characters in a line will be 40.

   C. The displayed width is exactly 40 characters.

   D. The user can edit the characters.
   翻译
   给出以下关于一个使用适当的字符间距的字体的TextField的表达式。
   …

   哪些叙述是对的?

   A. 被显示的字符串可以使用多种字体。

   B. 一行中最大的字符数是40

   C. 显示的宽度正好是40个字符宽。

   D. 用户可以编辑字符。

   答案 D

   解析 对于TextField的该种形式的构造函数来说,前一个参数是文本域中初始的字符串的显示值,而后一个是推荐的显示宽度,以列数表示,在构造文本域的时候会将这个大小设置为最佳大小,如果容器的限制使得文本域不能显示这么多也没有办法,一般来说是比这个大小大的,而且即使宽度很小,你也可以在文本域的一行中输入很长的字符串,只有你不使用回车,在超过显示宽度后文本域会自动出现水平滚动条(没有被设置为关闭,缺省是不关闭的),而文本域的缺省编辑方式是可编辑的,一个文本域只能使用一种字体,这个字体可以在运行的过程中动态的改变,但是文本域中的所有字符串都将使用这个字体显示。

   20. Which statements about the garbage collection are true?
   A. The program developer must create a thread to be responsible for free
the memory.

   B. The garbage collection will check for and free memory no longer needed.

   C. The garbage collection allow the program developer to explicity and
immediately free the memory.

   D. The garbage collection can free the memory used java object at expect
time.
   翻译
   关于垃圾收集的哪些叙述是对的。

   A. 程序开发者必须自己创建一个线程进行内存释放的工作。

   B. 垃圾收集将检查并释放不再使用的内存。

   C. 垃圾收集允许程序开发者明确指定并立即释放该内存。

   D. 垃圾收集能够在期望的时间释放被java对象使用的内存。

   答案 B
0
   解析 Java语言将内存分配和释放的工组交给了自己,程序员不必做这些工作,它提供一个系统级的线程跟踪每个内存的分配,在JVM的空闲处理中,垃圾收集线程将检查和释放不再使用的内存(即可以被释放的内存)。垃圾收集的过程在java程序的生存期中是自动的,不需要分配和释放内存,也避免了内存泄漏。可以调用System.gc()方法建议(suggest)JVM执行垃圾收集以使得可被释放的内存能立即被使用,当此方法返回的时候,JVM已经做了最大的努力从被丢弃的对象上回收内存空间。程序员不能指定收集哪些内存,一般而言也不用关心这个问题,除非是程序的内存消耗很大,特别是有很多临时对象时可以“建议“进行垃圾收集以提高可用内存。需要指出的是调用System.gc()方法不能保证JVM立即进行垃圾收集,而只能是建议,因为垃圾收集线程的优先级很低(通常是最低的)

21、Which of the following assignment is not correct?
   A. float f = 11.1;

   B. double d = 5.3E12;

   C. double d = 3.14159;

   D. double d = 3.14D.

   (a)

   题目:下面的哪些赋值语句是对的。

   浮点数的赋值是带有小数点的数字缺省是double型的,如果在浮点数后面加f或者F则是float,后面加d或者D则是double,科学计数法形式的浮点数也是double型的,而double的精度比float高,将一个高精度的double赋值给一个低精度的float时需要进行强制类型转换,反之则不需要。


   22、Given the uncompleted code of a class:
   class Person {
   String name, department;
   int age;
   public Person(String n){ name = n; }
   public Person(String n, int a){ name = n; age = a; }
   public Person(String n, String d, int a) {
   // doing the same as two arguments version of constructor
   // including assignment name=n,age=a
   department = d;
   }
   }
   Which expression can be added at the "doing the same as..." part of the constructor?

   A. Person(n,a);

   B. this(Person(n,a));

   C. this(n,a);

   D. this(name,age).

   (c)

   题目:给出下面的不完整的类代码:
   …
   下面的哪些表达式可以加到构造方法中的"doing the same as..."处?

   在同一个类的不同构造方法中调用该类的其它构造方法需要使用this(…)的形式,而且必须是在构造方法的第一行调用,这个和普通的方法重载调用的方式不同,普通的方法可以直接使用方法名加参数来调用,而且调用位置没有限制,因此答案A是不行的,B的语法就是错误的,D的错误在于在父类型的构造函数被调用前不能引用类的成员。构造方法是一个类对象实例化的起点(虽然严格来说首先执行的并不是构造方法的第一个语句,而是内存的分配),因此在构造方法中不能将成员作为参数引用。

   23、Which of the following statements about variables and their scopes are true?

   A. Instance variables are member variables of a class.

   B. Instance variables are declared with the static keyword.

   C. Local variables defined inside a method are created when the method is executed.

   D. Local variables must be initialized before they are used.
  (acd)

   题目:下面关于变量及其范围的陈述哪些是对的。

   A. 实例变量是类的成员变量。

   B. 实例变量用关键字static声明。

   C. 在方法中定义的局部变量在该方法被执行时创建

   D. 局部变量在使用前必须被初始化。

   类中有几种变量,分别是:局部变量(英文可以为:local\automatic\temporary\stack variable)是定义在方法里的变量;实例变量(英文为:instance variable)是在方法外而在类声明内定义的变量,有时也叫成员变量;类变量(英文为:class variable)是用关键字static声明的实例变量,他们的生存期分别是:局部变量在定义该变量的方法被调用时被创建,而在该方法退出后被撤销;实例变量在使用new Xxxx()创建该类的实例时被创建,而其生存期和该类的实例对象的生存期相同;类变量在该类被加载时被创建,不一定要用new Xxxx()创建,所有该类的实例对象共享该类变量,其生存期是类的生存期。任何变量在使用前都必须初始化,但是需要指出的是局部变量必须显式初始化,而实例变量不必,原始类型的实例变量在该类的构造方法被调用时为它分配的缺省的值,整型是0,布尔型是false,而浮点型是0.0f,引用类型(类类型)的实例变量的缺省值是null(没有进行实际的初始化,对它的使用将引起NullPointException),类变量的规则和实例变量一样,不同的是类变量的初始化是在类被加载时。

   24、public void test() {
   try { oneMethod();
   System.out.println("condition 1");
   } catch (ArrayIndexOutOfBoundsException e) {
   System.out.println("condition 2");
   } catch(Exception e) {
   System.out.println("condition 3");
   } finally {
   System.out.println("finally");
   }

  }
   Which will display if oneMethod run normally?
   A. condition 1

   B. condition 2

   C. condition 3

   D. finally

   (ad)

   题目:在oneMethod()方法运行正常的情况下将显示什么?

   如果try块中的语句在执行时发生异常,则执行从该处中断而进入catch块,根据异常的类型进行匹配,最前面的优先进行匹配比较,只要该异常是catch中指定的异常的子类就匹配成功进而执行相应的catch中的内容,而finally块中的内容无论是否发生异常都将被执行。

   25、Given the following code:
   public class Test {
   void printValue(int m){
   do { System.out.println("The value is"+m);
   }
   while( --m > 10 )
}
   public static void main(String arg[]) {
   int i=10;
   Test t= new Test();
   t.printValue(i);
   }
   }
   Which will be output?
   A. The value is 8
   B. The value is 9

   C. The value is 10

   D. The value is 11

   (c)

   题目:给出下面的代码:
   …
   输出将是什么?

   此题考察的是do… while循环和 -- 操作符的知识,do…while最少被执行一次,在执行完do中的内容后判断while中的条件是否为true,如果为true的话就再执行do中的内容,然后再进行判断,以此类推直到while的判断为false时退出循环执行循环后面的内容,而—操作符的规则是在变量右边的-- 将先进行运算,然后才是使变量的值减一,而在变量左边的是先将变量的值减一再运算。



26、Which of the following statements about declaration are true?
   A. Declaration of primitive types such as boolean, byte and so on does not allocate memory space for the variable.

   B. Declaration of primitive types such as boolean, byte and so on allocates memory space for the variable.

   C. Declaration of nonprimitive types such as String, Vector and so on does not allocate memory space for the object.

   D. Declaration of nonprimitive types such as String, Vector ans so on allocates memory space for the object.

   (ad)

   题目:下面的有关声明的哪些叙述是对的。
   A. 对原始数据类型例如boolean,byte的变量的声明不会为该变量分配内存空间。

   B. 对原始数据类型例如boolean,byte的变量的声明将为之分配内存空间。

   C. 非原始数据类型例如String,Vector的变量的声明不会为该对象分配内存。

   D. 非原始数据类型例如String,Vector的变量的声明会为该对象分配内存。

   对原始数据类型的变量的声明将为之分配内存并赋予一个缺省值,参见23题的叙述,而非原始数据类型的变量必须用new Xxxx()分配内存及初始化。但是严格来讲此题的答案有待确定,因为只有原始类型的实例变量和类变量的声明在类对象被创建/类被加载时完成内存的自动分配,而原始类型的局部变量必须显式初始化,从这点来看原始类型的局部变量没有被自动分配内存,SL275中只提出了非原始数据类型的变量必须使用new Xxxx()完成内存的分配而没有指出原始数据类型的变量是否在声明时即自动进行内存分配,而从局部变量不能在显式初始化前使用这点来看在声明时没有进行内存分配。因此答案a的正确性还有待官方的确定。

   27、In the Java API documentation which sections are included in a class document?
   A. The description of the class and its purpose

   B. A list of methods in its super class

   C. A list of member variable

   D. The class hierarchy

   (acd)

   题目:在Java API文档中下面的哪些部分被包括在内
   A. 类及用途的描述

   B. 父类的方法的列表

   C. 成员变量的列表

   D. 类层次

   类文档的内容主要是:类层次、类及用途描述、成员变量列表、构造方法列表、成员方法列表、从类层次上继承的方法列表、成员变量的详细说明、构造方法详细说明、成员方法详细说明。

   28、Given the following code:
   1) public void modify() {

   2) int i, j, k;

   3) i = 100;

   4) while ( i > 0 ) {

   5) j = i * 2;

  6) System.out.println (" The value of j is " + j );

   7) k = k + 1;

   8) i--;

   9) }

   10) }
   Which line might cause an error during compilation?
   A. line 4

   B. line 6

   C. line 7

   D. line 8

   (c)

   题目:给出下面的代码:
   …
   哪些行在编译时可能产生错误。

   这个问题在前面有关变量的类型及其作用域的问题中讨论过,局部变量在使用前必须显式初始化,而代码中的变量k在使用前没有。

   29、Which of the following statements about variables and scope are true?
   A. Local variables defined inside a method are destroyed when the method is exited.

   B. Local variables are also called automatic variables.

   C. Variables defined outside a method are created when the object is constructed.

   D. A method parameter variable continues to exist for as long as the object is needed in which the method is defined.

   (abc)

   题目:下面有关变量及其作用域的陈述哪些是对的。
   A. 在方法里面定义的局部变量在方法退出的时候被撤销。

   B. 局部变量也叫自动变量。

   C. 在方法外面定义的变量(译注:即实例变量)在对象被构造时创建。

   D. 在方法中定义的方法的参变量只要该对象被需要就一直存在。

   本题还是讨论变量的类型及作用域,参看前面的叙述。

   30、A class design requires that a member variable cannot be accessible directly outside the class. Which modifier should be used to obtain the access control?
   A. public

   B. no modifier

   C. protected

   D. private

   (d)

   题目:类的设计要求它的某个成员变量不能被外部类直接访问。应该使用下面的哪些修饰符获得需要的访问控制。

这个在前面也有叙述,java有四种访问类型,分别为:public,protected,default,private,其中public变量可以被所有的外部类访问,而pretected的可以被同一个包及该类的子类访问,default即没有任何修饰符的变量可以被同一个包中的类访问,而private变量只能在被该类内部被访问。题目中的外部类应该理解为除该类自身的所有其它类,因此只有使用private可以达到要求。
31、Given the following code fragment:
   1) String str = null;

   2) if ((str != null) && (str.length() > 10)) {

   3) System.out.println("more than 10");

   4) }

   5) else if ((str != null) & (str.length() < 5)) {

   6) System.out.println("less than 5");

   7) }

   8) else { System.out.println("end"); }
   Which line will cause error?

   A. line 1

   B. line 2

   C. line 5

   D. line 8

   (c)

   题目:给出下面的代码片断:
   …
   哪些行将导致错误。

   此题需要将代码仔细看清楚,查询没有逻辑错误,if …else的使用没有问题,也没有拼写错误,错误在于第5行的“与”操作符的使用,逻辑操作符(logical operator)的“与” 应该是&&,而&是位逻辑操作符(bitwise logical operator)的“与”,使用的对象不一样,逻辑操作符的“与”的左右操作数都应该是布尔型(logical boolan)的值,而位逻辑操作符的左右操作数都是整型(integral)值。

   32、Which statements about Java code security are true?

   A. The bytecode verifier loads all classes needed for the execution of a program.

   B. Executing code is performed by the runtime interpreter.

   C. At runtime the bytecodes are loaded, checked and run in an interpreter.

   D. The class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.

   (bcd)

   题目:下面有关java代码安全性的叙述哪些是对的。
   A. 字节码校验器加载查询执行需要的所有类。

   B. 运行时解释器执行代码。

   C. 在运行时,字节码被加载,验证然后在解释器里面运行。

   D. 类加载器通过分离本机文件系统的类和从网络导入的类增加安全性。

   SL275中描述的Java程序运行的过程是这样的:类加载器(class loader)加载程序运行所需要的所有类,它通过区分本机文件系统的类和网络系统导入的类增加安全性,这可以限制任何的特洛伊木马程序,因为本机类总是先被加载,一旦所有的类被加载完,执行文件的内存划分就固定了,在这个时候特定的内存地址被分配给对应的符号引用,查找表(lookuo table)也被建立,由于内存划分发生在运行时,解释器在受限制的代码区增加保护防止未授权的访问;然后字节码校验器(byte code verifier)进行校验,主要执行下面的检查:类符合JVM规范的类文件格式,没有违反访问限制,代码没有造成堆栈的上溢或者下溢,所有操作 代码的参数类型都是正确的,没有非法的数据类型转换(例如将整型数转换成对象类型)发生;校验通过的字节码被解释器(interpreter)执行,解释器在必要时通过运行时系统执行对底层硬件的合适调用。后三个答案是SL275中的原话。

   33、Given the following code:
   public class Person{
   static int arr[] = new int[10];
   public static void main(String a[]) {
   System.out.println(arr[1];)
   }
   }
   Which statement is correct?
   A. When compilation some error will occur.

   B. It is correct when compilation but will cause error when running.

   C. The output is zero.

   D. The output is null.

   (c)

   题目:给出下面的代码:
   …
   那个叙述是对的。

   A. 编译时将发生错误。

   B. 编译时正确但是运行时出错。

   C. 输出为0。

   D. 输出为null

   int型数组是类对象,它在类被加载时完成初始化,在前面题目中已经有叙述,由于是原始数据类型int,其初始值为0。


就算我现在什么都没有,擦掉了眼泪还是抬头要挺胸,面带笑容不气馁往前冲。 我越挫越勇,我永远不退缩。
2006-03-31 16:59
l54515429
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2005-12-22
收藏
得分:0 

34、Given the following code:
   public class Person{
   int arr[] = new int[10];
   public static void main(String a[]) {
   System.out.println(arr[1]);
   }
   }
   Which statement is correct?
   A. When compilation some error will occur.

   B. It is correct when compilation but will cause error when running.

   C. The output is zero.

   D. The output is null.

   (a)

   给出下面的代码:
   … 
   哪些叙述是对的。
   A. 编译时出错。

   B. 编译时正确而运行时出错。

   C. 输出0。

   D. 输出null。

   实例变量在类的一个实例构造时完成初始化,而且在类的静态方法中不能直接访问类的非静态成员而只能访问类成员(像上题中一样),类的普通方法可以访问类的所有成员和方法,而静态方法只能访问类的静态成员和方法,因为静态方法属于类,而普通方法及成员变量属于类的实例,类方法(静态方法)不能使用属于某个不确定的类的实例的方法和变量,在静态方法里面没有隐含的this,而普通方法有。
35、public class Parent {
   public int addValue( int a, int b) {
   int s;
   s = a+b;
   return s;
   }
   }
   class Child extends Parent {

   }
   Which methods can be added into class Child?
   A. int addValue( int a, int b ){// do something...}

   B. public void addValue (){// do something...}

   C. public int addValue( int a ){// do something...}

   D. public int addValue( int a, int b )throws MyException {//do something...}

   (bc)

   题目:哪些方法可以加入类Child中。

   此题涉及方法重载(overload),方法重写(override)以及类派生时方法重写的规则。方法重载的规则是:一、参数列表必须不同,个数的不同完全可以,如果个数相同则参数类型的不同不能引起歧意,例如int 和long,float和double就不能作为唯一的类型不同;二、返回值可以不同,但是不能是重载时唯一的不同点(这点和c++中不同,c++中返回类型必须一致)。方法重写发生在类继承时,子类可以重写一个父类中已有的方法,必须在返回类型和参数列表一样时才能说是重写,否则就是重载,java中方法重写的一个重要而且容易被忽略的规则是重写的方法的访问权限不能比被重写的方法的访问权限低!重写的另一个规则是重写的方法不能比被重写的方法抛弃(throws)更多种类的异常,其抛弃的异常只能少,或者是其子类,不能以抛弃异常的个数来判断种类,而应该是异常类层次结果上的种类。此题中答案a的错误就是重写的访问权限比被重写的方法的低,而b,c都属于重载,d的错误在于比被重写的方法抛弃了更多种类的异常。



36、A member variable defined in a class can be accessed only by the classes in the same package. Which modifier should be used to obtain the access control?
   A. private
   B. no modifier
   C. public
   D. protected
   (b)

   题目:一个类中定义的成员变量只能被同一包中的类访问。下面的哪些修饰符可以获得需要的访问控制。

   参看前面的题目中的叙述。

   37、A public member vairable called MAX_LENGTH which is int type, the value of the variable remains constant value 100. Use a short statement to define the variable.
   A. public int MAX_LENGTH=100;

   B. final int MAX_LENGTH=100;

   C. final public int MAX_LENGTH=100;

   D. public final int MAX_LENGTH=100.

   (d)

   题目:共有成员变量MAX_LENGTH是一个int型值,变量的值保持常数值100。使用一个短声明定义这个变量。

   Java中共有变量使用public定义,常量变量使用final,另外注意的是修饰符的顺序,一个最完整的修饰是public static final int varial_a=100;这个顺序不能错,这和c++中也是 不同的。而答案c恰恰错在修饰符的顺序上。

   38、Which expressions are correct to declare an array of 10 String objects?

   A. char str[];

   B. char str[][];

   C. String str[];

   D. String str[10];

   (c)

   题目:哪些表达式是声明一个含有10个String对象的数组。

   严格来说这个题目没有给出一个正确的答案,唯一比较正确的是c,而完全满足题目要求的应该是:String str[]=new String[10];
注意答案d的形式是不对的,这和c++也是不同的。

   39、Which fragments are correct in Java source file?
   A. package testpackage;
   public class Test{//do something...}

   B. import java.io.*;
   package testpackage;
   public class Test{// do something...}

   C. import java.io.*;
   class Person{// do something...}
   public class Test{// do something...}

   D. import java.io.*;
   import java.awt.*;
   public class Test{// do something...}

   (acd)

   题目:下面的那个java源文件代码片断是对的。

   Java中的package语句必须是源文件中除去说明以外的第一条语句,导入包语句可以有几个,但是必须位于package语句之后,其它类定义之前,一个源文件中可以有几个类,但最多只能有一个是public的,如果有,则源文件的文件名必须和该类的类名相同。

   40:
   String s= "hello";
   String t = "hello";
   char c[] = {'h','e','l','l','o'} ;
   Which return true?
   A. s.equals(t);

   B. t.equals(c);

   C. s==t;

   D. t.equals(new String("hello"));

   E. t==c.

   (acd)

   题目:哪些返回true。

   这个在前面第10题的equals()方法和==操作符的讨论中论述过。==操作符比较的是操作符两端的操作数是否是同一个对象,而String的equals()方法比较的是两个String对象的内容是否一样,其参数是一个String对象时才有可能返回true,其它对象都返回假。需要指出的是由于s和t并非使用new创建的,他们指向内存池中的同一个字符串常量,因此其地址实际上是相同的(这个可以从反编译一个简单的测试程序的结果得到,限于篇幅不列出测试代码和反编译的分析),因此答案c也是正确的。

41、Which of the following statements are legal?
   A. long l = 4990;
   B. int i = 4L;
   C. float f = 1.1;
   D. double d = 34.4;
   E. double t = 0.9F.
   (ade)

   题目:下面的哪些声明是合法的。

   此题的考点是数字的表示法和基本数据类型的类型自动转换,没有小数点的数字被认为是int型数,带有小数点的数被认为是double型的数,其它的使用在数字后面加一个字母表示数据类型,加l或者L是long型,加d或者D是double,加f或者F是float,可以将低精度的数字赋值给高精度的变量,反之则需要进行强制类型转换,例如将int,short,byte赋值给long型时不需要显式的类型转换,反之,将long型数赋值给byte,short,int型时需要强制转换(int a=(int)123L;)。

   42、
   public class Parent {
   int change() {…}
   }
   class Child extends Parent {

   }
   Which methods can be added into class Child?
   A. public int change(){}

   B. int chang(int i){}

   C. private int change(){}

   D. abstract int chang(){}

   (ab)

   题目:哪些方法可被加入类Child。

   这个题目的问题在第35题中有详尽的叙述。需要注意的是答案D的内容,子类可以重写父类的方法并将之声明为抽象方法,但是这引发的问题是类必须声明为抽象类,否则编译不能通过,而且抽象方法不能有方法体,也就是方法声明后面不能带上那两个大括号({}),这些D都不能满足。

   43、
   class Parent {
   String one, two;
   public Parent(String a, String b){
   one = a;
   two = b;
   }
   public void print(){ System.out.println(one); }
   }
   public class Child extends Parent {
   public Child(String a, String b){
   super(a,b);
   }
   public void print(){
   System.out.println(one + " to " + two);
   }
   public static void main(String arg[]){
   Parent p = new Parent("south", "north");
   Parent t = new Child("east", "west");
   p.print();
   t.print();
   }
   }
   Which of the following is correct?
   A. Cause error during compilation.

   B. south
   east

   C. south to north
   east to west

   D. south to north
   east

   E. south
   east to west

   (e)

   题目:下面的哪些正确。
   A. 在编译时出错。

   这个题目涉及继承时的多态性问题,在前面的问题中已经有讲述,要注意的是语句t.print();在运行时t实际指向的是一个Child对象,即java在运行时决定变量的实际类型,而在编译时t是一个Parent对象,因此,如果子类Child中有父类中没有的方法,例如printAll(),那么不能使用t.printAll()。参见12题的叙述。

   44、A Button is positioned in a Frame. Only height of the Button is affected by the Frame while the width is not. Which layout manager should be used?
   A. FlowLayout

   B. CardLayout

   C. North and South of BorderLayout
   D. East and West of BorderLayout

   E. GridLayout

   (d)

   题目:一个按钮放在一个框架中,在框架改变时只影响按钮的高度而宽度不受影响,应该使用哪个布局管理器?

   这个还是布局管理器的问题,流布局管理器(FlowLayout)将根据框架的大小随时调整它里面的组件的大小,包括高度和宽度,这个管理器不会约束组件的大小,而是允许他们获得自己的最佳大小,一行满了以后将在下一行放置组件;卡片管理器(CardLayout)一次显式一个加入的组件(根据加入时的关键字);网格管理器(GridLayout)将容器划分为固定的网格,容器大小的改变将影响所有组件的大小,每个组件的大小都会同等地变化;边界管理器(BorderLayout)将容器划分为五个区域,分为东南西北和中间,东西区域的宽度为该区域里面组件的最佳宽度,高度为容器的高度减去南北区域的高度,这是一个可能变化的值,而南北区域的宽度为容器的整个宽度,高度为组件的最佳高度,中间区域的高度为容器的高度减去南北区域的高度,宽度为容器的宽度减去东西区域的宽度。

   45、Given the following code:
   1) class Parent {

   2) private String name;

   3) public Parent(){}

   4) }

   5) public class Child extends Parent {

   6) private String department;

   7) public Child() {}

   8) public String getValue(){ return name; }
   9) public static void main(String arg[]) {

   10) Parent p = new Parent();

11) }

   12) }
   Which line will cause error?
   A. line 3

   B. line 6

   C. line 7

   D. line 8

   E. line 10

   (d)

   题目:给出下面的代码:
   …
   哪些行将导致错误。

   第8行的getValue()试图访问父类的私有变量,错误,参看前面有关变量类型及其作用域的叙述。
46、The variable "result" is boolean. Which expressions are legal?
   A. result = true;

   B. if ( result ) { // do something... }

   C. if ( result!= 0 ) { // so something... }

   D. result = 1

   (ab)

   题目:变量"result"是一个boolean型的值,下面的哪些表达式是合法的。

   Java的boolean不同于c或者c++中的布尔值,在java中boolean值就是boolean值,不能将其它类型的值当作boolean处理。

   47、Class Teacher and Student are subclass of class Person.
   Person p;
   Teacher t;
   Student s;
   p, t and s are all non-null.
   if(t instanceof Person) { s = (Student)t; }
   What is the result of this sentence?
   A. It will construct a Student object.

   B. The expression is legal.

   C. It is illegal at compilation.

   D. It is legal at compilation but possible illegal at runtime.

   (c)

   题目:类Teacher和Student都是类Person的子类
   …
   p,t和s都是非空值
   …
   这个语句导致的结果是什么

   A. 将构造一个Student对象。

   B. 表达式合法。

   C. 编译时非法。

   D. 编译时合法而在运行时可能非法。

   instanceof操作符的作用是判断一个变量是否是右操作数指出的类的一个对象,由于java语言的多态性使得可以用一个子类的实例赋值给一个父类的变量,而在一些情况下需要判断变量到底是一个什么类型的对象,这时就可以使用instanceof了。当左操作数是右操作数指出的类的实例或者是子类的实例时都返回真,如果是将一个子类的实例赋值给一个父类的变量,用instanceof判断该变量是否是子类的一个实例时也将返回真。此题中的if语句的判断没有问题,而且将返回真,但是后面的类型转换是非法的,因为t是一个Teacher对象,它不能被强制转换为一个Student对象,即使这两个类有共同的父类。如果是将t转换为一个Person对象则可以,而且不需要强制转换。这个错误在编译时就可以发现,因此编译不能通过。

   48、Given the following class:
   public class Sample{
   long length;
   public Sample(long l){ length = l; }
   public static void main(String arg[]){
   Sample s1, s2, s3;
   s1 = new Sample(21L);
   s2 = new Sample(21L);
   s3 = s2;
   long m = 21L;
   }
   }
   Which expression returns true?
   A. s1 == s2;

   B. s2 == s3;

   C. m == s1;

   D. s1.equals(m).

   (b)

   题目:给出下面的类:
   …
   哪个表达式返回true。

   前面已经叙述过==操作符和String的equals()方法的特点,另外==操作符两边的操作数必须是同一类型的(可以是父子类之间)才能编译通过。

   49、Given the following expression about List.
   List l = new List(6,true);
   Which statements are ture?

   A. The visible rows of the list is 6 unless otherwise constrained.

   B. The maximum number of characters in a line will be 6.

   C. The list allows users to make multiple selections

   D. The list can be selected only one item.

   (ac)

   题目:给出下面有关List的表达式:
   …
   哪些叙述是对的。

   A. 在没有其它的约束的条件下该列表将有6行可见。

   B. 一行的最大字符数是6

   C. 列表将允许用户多选。

   D. 列表只能有一项被选中。

   List组件的该构造方法的第一个参数的意思是它的初始显式行数,如果该值为0则显示4行,第二个参数是指定该组件是否可以多选,如果值为true则是可以多选,如果不指定则缺省是不能多选。


就算我现在什么都没有,擦掉了眼泪还是抬头要挺胸,面带笑容不气馁往前冲。 我越挫越勇,我永远不退缩。
2006-03-31 17:00
l54515429
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2005-12-22
收藏
得分:0 

50、Given the following code:
   class Person {
   String name,department;
   public void printValue(){
   System.out.println("name is "+name);
   System.out.println("department is "+department);
   }
   }
   public class Teacher extends Person {
   int salary;
   public void printValue(){
   // doing the same as in the parent method printValue()
   // including print the value of name and department.
   System.out.println("salary is "+salary);
   }
   }
   Which expression can be added at the "doing the same as..." part of the method printValue()?
A. printValue();
   B. this.printValue();

   C. person.printValue();

   D. super.printValue().

   (d)

   题目:给出下面的代码:
   …
   下面的哪些表达式可以加入printValue()方法的"doing the same as..."部分。

   子类可以重写父类的方法,在子类的对应方法或其它方法中要调用被重写的方法需要在该方法前面加上”super.”进行调用,如果调用的是没有被重写的方法,则不需要加上super.进行调用,而直接写方法就可以。这里要指出的是java支持方法的递归调用,因此答案a和b在语法上是没有错误的,但是不符合题目代码中说明处的要求:即做和父类的方法中相同的事情打印名字和部门,严格来说也可以选a和b。


51、Which is not a method of the class InputStream?
   A. int read(byte[])
   B. void flush()
   C. void close()
   D. int available()
   (b)
   题目:下面哪个不是InputStream类中的方法

   这个题目没有什么好说的,要求熟悉java API中的一些基本类,题目中的InputStream是所有输入流的父类,所有要很熟悉,参看JDK的API文档。方法void flush()是缓冲输出流的基本方法,作用是强制将流缓冲区中的当前内容强制输出。

   52、Which class is not subclass of FilterInputStream?
   A. DataInputStream

   B. BufferedInputStream

   C. PushbackInputStream

   D. FileInputStream

   (d)

   题目:
   哪个不是FilterInputStream的子类。

   此题也是要求熟悉API基础类。Java基础API中的FilterInputStream 的已知子类有:BufferedInputStream, CheckedInputStream, CipherInputStream, DataInputStream, DigestInputStream, InflaterInputStream, LineNumberInputStream, ProgressMonitorInputStream, PushbackInputStream 。

   53、Which classes can be used as the argument of the constructor of the class
FileInputStream?
   A. InputStream

   B. File

   C. FileOutputStream

   D. String

   (bd)

   题目:哪些类可以作为FileInputStream类的构造方法的参数。

   此题同样是要求熟悉基础API,FileInputStream类的构造方法有三个,可接受的参数分别是:File、FileDescriptor、String类的一个对象。

   54、Which classes can be used as the argument of the constructor of the class FilterInputStream?
   A. FilterOutputStream

   B. File

   C. InputStream

   D. RandomAccessFile

   (c)

   题目:哪些类可以作为FilterInputStream类的构造方法的参数。

   FilterInputStream的构造方法只有一个,其参数是一个InputStream对象。

   55、Given the following code fragment:
   1) switch(m)

   2) { case 0: System.out.println("case 0");

   3) case 1: System.out.println("case 1"); break;

   4) case 2:

   5) default: System.out.println("default");

   6) }
   Which value of m would cause "default" to be the output?
   A. 0

   B. 1

   C. 2

   D. 3

   (cd)

   题目:给出下面的代码片断:
   …
   m为哪些值将导致"default"输出。

   此题考察switch语句的用法,switch的判断的条件必须是一个int型值,也可以是byte、short、char型的值,case中需要注意的是一个case后面一般要接一个break语句才能结束判断,否则将继续执行其它case而不进行任何判断,如果没有任何值符合case列出的判断,则执行default的语句,default是可选的,可以没有,如果没有default而又没有任何值匹配case中列出的值则switch不执行任何语句。


56、Given the uncompleted method:
   1)

   2) { success = connect();

   3) if (success==-1) {

   4) throw new TimedOutException();

   5) }

   6)}
   TimedOutException is not a RuntimeException. Which can complete the method of declaration when added at line 1?

   A. public void method()

   B. public void method() throws Exception

   C. public void method() throws TimedOutException

   D. public void method() throw TimedOutException

   E. public throw TimedOutException void method()

   (bc)

   题目:给出下面的不完整的方法:
   …
   TimedOutException 不是一个RuntimeException。下面的哪些声明可以被加入第一行完成此方法的声明。

   如果程序在运行的过程中抛出异常,而这个异常又不是RuntimeException或者Error,那 么程序必须捕获这个异常进行处理或者声明抛弃(throws)该异常,捕获异常可以使用try{}catch(){}语句,而抛弃异常在方法声明是声明,在方法的声明后面加上throws XxxxException,抛弃多个异常时在各异常间使用逗号(,)分隔,题目中的程序在运行时抛出的不是一个RuntimeException,所有必须捕获或者抛弃,而程序又没有捕获,所有应该在方法声明中声明抛弃。由于Exception是所有异常的父类,所有当然也可以代表RuntimeException了。

   57、Which of the following answer is correct to express the value 10 in hexadecimal number?
   A. 0xA

   B. 0x16

   C. 0A

   D. 016

   (a)

   题目:下面的哪些答案可以正确表示一个十六进制数字10。

   十六进制数以0x开头,以0开头的是八进制数。十六进制表示中的a,b,c,d,e,f依次为10,11,12,13,14,15。

   58、Which statements about thread are true?
   A. Once a thread is created, it can star running immediately.

   B. To use the start() method makes a thread runnable, but it does not necessarily start immediately.

   C. When a thread stops running because of pre-emptive, it is placed at the front end of the runnable queue.

   D. A thread may cease to be ready for a variety of reasons.

   (bd)

   题目:有关线程的哪些叙述是对的。

   A. 一旦一个线程被创建,它就立即开始运行。

   B. 使用start()方法可以使一个线程成为可运行的,但是它不一定立即开始运行。

   C. 当一个线程因为抢先机制而停止运行,它被放在可运行队列的前面。

   D. 一个线程可能因为不同的原因停止(cease)并进入就绪状态。

   一个新创建的线程并不是自动的开始运行的,必须调用它的start()方法使之将线程放入可运行态(runnable state),这只是意味着该线程可为JVM的线程调度程序调度而不是意味着它可以立即运行。线程的调度是抢先式的,而不是分时间片式的。具有比当前运行线程高优先级的线程可以使当前线程停止运行而进入就绪状态,不同优先级的线程间是抢先式的,而同级线程间是轮转式的。一个线程停止运行可以是因为不同原因,可能是因为更高优先级线程的抢占,也可能是因为调用sleep()方法,而即使是因为抢先而停止也不一定就进入可运行队列的前面,因为同级线程是轮换式的,它的运行可能就是因为轮换,而它因抢占而停止后只能在轮换队列中排队而不能排在前面。

   59、The method resume() is responsible for resuming which thread's execution?
   A. The thread which is stopped by calling method stop()

   B. The thread which is stopped by calling method sleep()

   C. The thread which is stopped by calling method wait()

   D. The thread which is stopped by calling method suspend()

   (d)

   题目:方法resume()负责恢复哪些线程的执行。
   A. 通过调用stop()方法而停止的线程。

   B. 通过调用sleep()方法而停止运行的线程。

   C. 通过调用wait()方法而停止运行的线程。

   D. 通过调用suspend()方法而停止运行的线程。

   Thread的API文档中的说明是该方法恢复被挂起的(suspended)线程。该方法首先调用该线程的无参的checkAccess() 方法,这可能在当前线程上抛出SecurityException 异常,如果该线程是活着的(alive)但是被挂起(suspend),它被恢复并继续它的执行进程。

   60、Given the following code:
   1) public class Test {

   2} int m, n;

   3} public Test() {}

   4} public Test(int a) { m=a; }

   5} public static void main(String arg[]) {

   6} Test t1,t2;

   7} int j,k;

   8} j=0; k=0;

   9} t1=new Test();
10} t2=new Test(j,k);

   11} }
  12} }
   Which line would cause one error during compilation?

   A. line 3

   B. line 5

   C. line 6

   D. line 10

   (d)

   题目:给出下面的代码:
   …
   在编译时哪行将导致一个错误。

   第10行的声明调用一个带两个参数的Test的构造方法,而该类没有这样的构造方法。


就算我现在什么都没有,擦掉了眼泪还是抬头要挺胸,面带笑容不气馁往前冲。 我越挫越勇,我永远不退缩。
2006-03-31 17:01
千里冰封
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:灌水之王
等 级:版主
威 望:155
帖 子:28477
专家分:59
注 册:2006-2-26
收藏
得分:0 
这值得大家去看看

可惜不是你,陪我到最后
2006-03-31 18:51
musicyxy
Rank: 1
等 级:新手上路
帖 子:120
专家分:0
注 册:2004-8-14
收藏
得分:0 
相当的感谢了!!!

2006-03-31 21:25
hkxyz
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2005-8-11
收藏
得分:0 
SCJP一定是英文的卷子吗?一个台湾朋友说可以选择繁体中文考试!
我们这可以选中文的吗?合格率也是61%吗?

2006-04-01 10:08
千里冰封
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:灌水之王
等 级:版主
威 望:155
帖 子:28477
专家分:59
注 册:2006-2-26
收藏
得分:0 
现在已经有中文的试卷了

可惜不是你,陪我到最后
2006-04-01 10:11
hkxyz
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2005-8-11
收藏
得分:0 
HOHO,是吗!那就太好了,不用羡慕台湾人了!
要是考试票能便宜点就更好了,贵啊...

2006-04-01 10:19
小小
Rank: 1
等 级:新手上路
威 望:1
帖 子:219
专家分:0
注 册:2004-5-31
收藏
得分:0 

这东西好
正需要,谢谢
还有
果真可以选中文的卷子?呵呵


有一天咖啡的舞者 £
2006-04-01 17:37
快速回复:[转载]SCJP认证套题解析
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021237 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved