1.簡(jiǎn)單的一題,錯(cuò)了.
          自動(dòng)轉(zhuǎn)型
          class Test {
           void test(int i){
            System.out.println("i");
           }
           void test(String s){
            System.out.println("s");
           }

           public static void main(String[] args){
            Test t=new Test();
            char ch='y';

            t.test(y);
           }
          }

          運(yùn)行結(jié)果為"i",在編譯自動(dòng)把字符型轉(zhuǎn)換為整型!!

          2.Reader/Writer只處理Unicode字符的輸入輸出。float和double可以通過(guò)stream進(jìn)行I/O

          3.線程
          public class Z { 
          public static void main(String[] args) { 
            new Z(); 
            } 
             
            Z() { 
             Z alias1 = this; 
             Z alias2 = this; 
             synchronized(alias1) { 
            try { 
             alias2.wait(); 
             System.out.println(“DONE WAITING”); 
             } 
             catch (InterruptedException e) { 
             System.out.println(“INTERR UPTED”); 
             } 
             catch (Exception e) { 
            System.out.println(“OTHER EXCEPTION”); 
            } 
            finally { 
             System.out.println (“FINALLY”); 

            } 
            } 
             System.out.println(“ALL DONE”); 
            } 
            } 
          alias1,alias2引用同一個(gè)對(duì)象,當(dāng)執(zhí)行wait()方法時(shí),線程放棄對(duì)象鎖,因無(wú)notifyAll()和notify()方法,{這個(gè)方法是把對(duì)象的等待池中的線程放入對(duì)象的鎖池,以便獲得對(duì)象鎖},所以對(duì)象一直處于等待的狀態(tài)什么也不打印)

          13
          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. 
          A.m局域變量,等于未定義.B.在靜態(tài)方法中不能使用非靜態(tài)成員變量,可通過(guò)類的實(shí)例的引用來(lái)調(diào)用.
          如i=t.b
          C.a是私有成員.



          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          posts - 8, comments - 0, trackbacks - 0, articles - -1

          Copyright © yiraka

          主站蜘蛛池模板: 贵港市| 汤阴县| 海宁市| 苏尼特左旗| 镇原县| 镇康县| 永兴县| 清镇市| 叙永县| 泰来县| 平谷区| 东港市| 虹口区| 涿州市| 梁平县| 玛曲县| 新津县| 兴安盟| 荔波县| 保定市| 安义县| 岗巴县| 宜春市| 大城县| 廉江市| 泸水县| 仁布县| 霸州市| 临江市| 霍邱县| 台安县| 泸水县| 平顶山市| 贵南县| 巍山| 巴东县| 崇信县| 平利县| 修武县| 东至县| 江津市|