JAVA模拟题:TestoftheJavaSkill(2)

文章作者 100test 发表时间 2007:03:14 17:03:22
来源 100Test.Com百考试题网


  Question 9:
   What code placed after the comment:
// Start For loop
   would populate the elements of the array ia[] with values of the variables i ?

   public class Lin{
   public static void main(String argv[]){
   Lin l = new Lin().
   l.amethod().
   }

   public void amethod(){
   int ia[] = new int[4].
   // Start For loop
   {
   ia[i] = i.
   System.out.println(ia[i]).
   }
   }
   }

   A. for(int i=0. i

   B. for (int i=0. i

   C. for(int i=0. i<4. i )

   D. for(int i=0. i

   Question 10:
   Consider the following code:
   Integer s = new Integer(9).
   Integer t = new Integer(9).
   Long u = new Long(9).
   Which test would return true?
  A. (s==u)

   B. (s==t)

   C. (s.equals(t))

   D. (s.equals(9))

   E. (s.equals(new Integer(9))

   Question 11:
   Which of the following is successfully create an instance of the Vector class and add an element?

   A. Vector v = new Vector(99).
   v[1]=99.

   B. Vector v = new Vector().
   v.addElement(99).

   C. Vector v = new Vector().
   v.add(99).

   D. Vector v = new Vector(100).
   v.addElement(“99”).

   Question 12:
   What will happen when you attempt to compile and run the following code?

   class Base{
   private void amethod(int iBase){
   System.out.println(“Base.amethod”).
   }
   }

   class Over extends Base{
   public static void main(String argv[]){
   Over o = new Over().
   int iBase=0.
   o.amethod(iBase).
   }

   public void amethod(int iOver){
   System.out.println(“Over.amethod”).
   }
   }

   A. Compile time error complaining that Base.amethod is private

   B. Runtime error complaining that Base.amethod is private

   C. Output of Base.amethod

   D. Output of Over.amethod


相关文章


scjp考题中的种种陷阱
Sun认证Java程序员5.0升级版本
Java源代码案例--骑士巡游问题
JAVA基础:JAVA程序中实现FTP的功能
JAVA模拟题:TestoftheJavaSkill(2)
Java认证模考试题(一)
64位环境中的Java(下)
64位环境中的Java(上)
JAVA教程:解析Java的多线程机制
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛