开发学院WEB开发Jsp Test of the Java Skill(4) 阅读

Test of the Java Skill(4)

 2008-01-05 20:29:18 来源:WEB开发网 闂傚倸鍊风欢姘缚瑜嶈灋闁圭虎鍠栫粻顖炴煥閻曞倹瀚�闂傚倸鍊风粈渚€骞夐敓鐘插瀭闁汇垹鐏氬畷鏌ユ煙閹殿喖顣奸柛搴$У閵囧嫰骞掗幋婵冨亾閻㈢ǹ纾婚柟鐐灱濡插牊绻涢崱妤冃℃繛宀婁簽缁辨捇宕掑鎵佹瀸闂佺懓鍤栭幏锟�濠电姷鏁告慨顓㈠箯閸愵喖宸濇い鎾寸箘閹规洟姊绘笟鈧ḿ褍煤閵堝悿娲Ω閳轰胶鍔﹀銈嗗笂閼冲爼鍩婇弴銏$厪闁搞儮鏅涙禒褏绱掓潏鈺佷槐闁轰焦鎹囬弫鎾绘晸閿燂拷闂傚倸鍊风欢姘缚瑜嶈灋闁圭虎鍠栫粻顖炴煥閻曞倹瀚�  闂傚倸鍊烽懗鑸电仚缂備胶绮〃鍛村煝瀹ュ鍗抽柕蹇曞У閻庮剟姊虹紒妯哄妞ゆ劗鍘ч埥澶娢熼柨瀣偓濠氭⒑瑜版帒浜伴柛鎾寸☉閳绘柨顫濋懜纰樻嫼闂佸憡绋戦オ鏉戔枔閺冣偓缁绘稓浠﹂崒姘瀳闂佸磭绮幑鍥嵁鐎n亖鏀介柟閭﹀墯椤斿倹淇婇悙顏勨偓鏍ь潖婵犳艾鍌ㄧ憸蹇涘箟閹绢喗鏅搁柨鐕傛嫹
核心提示: Question 25: What will happen when you attempt to compile and run the following code? int Output = 10; boolean b1 = false; if ((b1==true)&&((Output+=10)==2


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

   int Output = 10;
   boolean b1 = false;
   if ((b1==true)&&((Output+=10)==20)){
   System.out.PRintln(“We are equal “ + Output);
   }
   else{
   System.out.println(“Not equal!” + Output);
   }

   A. Compile error, attempting to perform binary comparison on logical data type

   B. Compilation and output of “We are equal 10”

   C. Compilation and output of “Not equal! 20”

   D. Compilation and output of “Not equal! 10”

   Question 26:
   Which of the following are true?

   A. java uses a time-slicing scheduling system for determining which Thread will execute.

   B. Java uses a pre-emptive, co-Operative system for determining which Thread will execute.

   C. Java scheduling is platform dependent and may vary from one implementation to another.

   D. You can set the priority of a Thread in code.
  Question 27:
   What will happen when you attempt to compile and run the following code?

   public class MySwitch{
   public static void main(String argv[]){
   MySwitch ms = new MySwitch();
   ms.amethod();
   }
   public void amethod(){
   int k=10;
   switch(k){
   default:
   System.out.println(“This is the default output”);
   break;
   case 10:
   System.out.println(“ten”);
   case 20:
   System.out.println(“twenty”);
   break;
   }
   }
   }

   A. None of these options

   B. Compile time error target of switch must be an integral type

   C. Compile and run with output “This is the default output”

   D. Compile and run with output “ten”

   Question 28:
   What will happen when you attempt to compile and run the following code?
   public class StrEq{
   public static void main(String argv[]){
   StrEq s = new StrEq();
   }
   private StrEq(){
   String s = “Marcus”;
   String s2 = new String(“Marcus”);
   if (s==s2){
   System.out.println(“we have a match”);
   }else{
   System.out.println(“Not equal”);
   }
   }
   }

   A. Compile time error caused by private constrUCtor

   B. Output of “we have a match”

   C. Output of “Not equal”

   D. Compile time error by attempting to compare string using ==

Tags:Test of the

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接