亚洲欧洲国产欧美一区精品,激情五月亚洲色五月,最新精品国偷自产在线婷婷,欧美婷婷丁香五月天社区

      考試首頁 | 考試用書 | 培訓(xùn)課程 | 模擬考場 | 考試論壇  
      全國  |             |          |          |          |          |         
        當(dāng)前位置:計(jì)算機(jī)等級(jí) > 二級(jí)考試 > Java語言程序設(shè)計(jì) > 考試輔導(dǎo) > 文章內(nèi)容
        

      全國計(jì)算機(jī)二級(jí)考試Java語言程序設(shè)計(jì)知識(shí)點(diǎn)(4)

      中華IT學(xué)院   【 】  [ 2016年4月27日 ]

      public class HelloWorld{

      public static void main(String args[]){

      System.out.print("Java HelloWorld!");

      }

      }

      解釋:以上java小應(yīng)用程序代碼輸出結(jié)果為Java HelloWorld!。

      HelloWorld.java

      import java.util.*;

       

      public class HelloWorld {

      public static void main(String[] args){

      System.out.println(new Date());

      Properties p = System.getProperties();

      p.list(System.out);

       

      try{

      Thread.currentThread().sleep(5 1000);

      }catch(InterruptedException e){}

      }

      }

      public class Parcel{

       class Contents{

       private int i = 11;

       public int value(){return i;}

       }

       

       class Destination{

       private String label;

       Destination(String what){label = what;}

       String readLabel(){return label;}

       }

       

       public static void main(String[] args)

       {

       Parcel p = new Parcel();

       Parcel.Contents c = p.new Contents();

       Parcel.Destination d = p.new Destination("Tanzania");

       }

      }

      // 從內(nèi)部類集成

      class Outer{

       class Inner{}

      }

       

      public class InheritInner extends Outer.Inner{

       //InheritInner() {} //Won't compile,need outer class'instance handle

       InheritInner(Outer outer){

       outer.super();

       }

       

       public static void main(String[] args){

       Outer outer = new Outer();

       InheritInner ii = new InheritInner(outer);

       }

      }

          用以下命令來調(diào)試代碼: javac HelloWorld.java java HelloWorld

          HelloWorld.java

          package mars;

          public class HelloWorld {...}

          javac -d . HelloWorld.java //加上-d .參數(shù)后,javac會(huì)自動(dòng)創(chuàng)建mars文件夾,并將HelloWorld.class放入該文件夾內(nèi)

          mars.mf (注意最后面一行內(nèi)容后面必須有一個(gè)空行,否則最后一行將被丟棄。)

          Main-Class: mars.HelloWorld

          jar cvfm mars.jar mars.mf mars

          java -jar mars.jar

          // 內(nèi)部類:生成Parcel.class、Parcel$Destination.class、Parcel$Contents.class

          // 如果內(nèi)部類是匿名的,那么編譯器會(huì)簡單地生成數(shù)字,把它們作為內(nèi)部類標(biāo)識(shí)符使用。若內(nèi)部類嵌套于其他內(nèi)部類中,則它們的名字簡單地追加在一個(gè)$以及外部類標(biāo)識(shí)符的后面。

      分享到:
      本文糾錯(cuò)】【告訴好友】【打印此文】【返回頂部
      將考試網(wǎng)添加到收藏夾 | 每次上網(wǎng)自動(dòng)訪問考試網(wǎng) | 復(fù)制本頁地址,傳給QQ/MSN上的好友 | 申請(qǐng)鏈接 | 意見留言 TOP
      關(guān)于本站  網(wǎng)站聲明  廣告服務(wù)  聯(lián)系方式  站內(nèi)導(dǎo)航  考試論壇
      Copyright © 2007-2013 中華考試網(wǎng)(Examw.com) All Rights Reserved