<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    推薦淘寶秋冬男裝熱賣(mài)網(wǎng)店

    追求無(wú)止境

    我的程序人生
    隨筆 - 31, 文章 - 2, 評(píng)論 - 20, 引用 - 0
    數(shù)據(jù)加載中……

    Java DOC學(xué)習(xí)筆記

    1、Interface Comparable<T>

    只有實(shí)現(xiàn)該接口的對(duì)象的列表或數(shù)組才能調(diào)用Collections.sort()方法。

    在實(shí)現(xiàn) int compareTo(T o)時(shí),需要注意:

    1、如果兩個(gè)對(duì)象相等,返回為0;

    2、如果同一個(gè)null對(duì)象進(jìn)行比較,應(yīng)拋出NullPointerException。

    3、實(shí)現(xiàn)必須保證sgn(x.compareTo(y)) == -sgn(y.compareTo(x))、(x.compareTo(y)==0) == (x.equals(y)) 、(x.compareTo(y)>0 && y.compareTo(z)>0) impliesx.compareTo(z)>0 。如果 x.compareTo(y)拋出異常,y.compareTo(x)也必須拋出異常。

    2、Interface Iterable<T>

    Iterator<T> iterator()

    對(duì)于鏈表等對(duì)象應(yīng)實(shí)現(xiàn)該接口來(lái)允許一個(gè)對(duì)象可以使用foreach語(yǔ)句。

    上面的方法返回java.util.Interface Iterator<E>,該接口的主要方法有:

    hasNext();next();remove();

    3、Interface Readable

    java.lang.Interface Readable

          一個(gè)Readable 是一個(gè)字符串的來(lái)源。實(shí)現(xiàn)這個(gè)接口需要實(shí)現(xiàn)的方法是:

    int read(CharBuffer cb)

    4、java.lang  Interface Runnable

    不用說(shuō),這個(gè)誰(shuí)都知道。如果想在一個(gè)單獨(dú)的線(xiàn)程中執(zhí)行,就需要實(shí)現(xiàn)這個(gè)接口。

    5、java.lang Interface Thread.UncaughtExceptionHandler

           從名字就可以判斷出來(lái),當(dāng)線(xiàn)程拋出未捕獲的異常時(shí),實(shí)現(xiàn)這個(gè)接口的類(lèi)的對(duì)象可以對(duì)一場(chǎng)進(jìn)行處理。

          官方文檔:當(dāng)線(xiàn)程被一個(gè)未捕獲的異常打斷時(shí),這個(gè)接口被調(diào)用。

          當(dāng)線(xiàn)程要被為捕獲異常打斷是,JVM使用Thread.getUncaughtExceptionHandler(),查詢(xún)異常處理器,如果線(xiàn)程沒(méi)有這個(gè)接口的設(shè)置,則查詢(xún)?cè)摼€(xiàn)程的ThreadGroup的UncaughtExceptionHandler,如果縣城沒(méi)有處理異常,他就會(huì)拋出這個(gè)異常。

    void uncaughtException(Thread t, Throwable e)
              Method invoked when the given thread terminates due to the given uncaught exception.

    6、包裝型對(duì)象:Boolean Byte Character Double Float Long Short Integer

        這些類(lèi)就不用了說(shuō)了,主要會(huì)使用里面的靜態(tài)方法和一些常量就可以了。

    7、Class Character.Subset

       這個(gè)類(lèi)的實(shí)例代表了Unicode字符集的特殊的子集。定義在Character中的唯一子集族類(lèi)是UnicodeBlock.其他的Java API或許因?yàn)樽约旱挠脩?hù)定義了其他的子集。

    static Character.UnicodeBlock
    AEGEAN_NUMBERS
              Constant for the "Aegean Numbers" Unicode character block.

    static Character.UnicodeBlock
    ALPHABETIC_PRESENTATION_FORMS
              Constant for the "Alphabetic Presentation Forms" Unicode character block.

    static Character.UnicodeBlock
    ARABIC
              Constant for the "Arabic" Unicode character block.

    static Character.UnicodeBlock
    ARABIC_PRESENTATION_FORMS_A
              Constant for the "Arabic Presentation Forms-A" Unicode character block.

    static Character.UnicodeBlock
    ARABIC_PRESENTATION_FORMS_B
              Constant for the "Arabic Presentation Forms-B" Unicode character block.

    static Character.UnicodeBlock
    ARMENIAN
              Constant for the "Armenian" Unicode character block.

    static Character.UnicodeBlock
    ARROWS
              Constant for the "Arrows" Unicode character block.

    static Character.UnicodeBlock
    BASIC_LATIN
              Constant for the "Basic Latin" Unicode character block.

    static Character.UnicodeBlock
    BENGALI
              Constant for the "Bengali" Unicode character block.

    static Character.UnicodeBlock
    BLOCK_ELEMENTS
              Constant for the "Block Elements" Unicode character block.

    static Character.UnicodeBlock
    BOPOMOFO
              Constant for the "Bopomofo" Unicode character block.

    static Character.UnicodeBlock
    BOPOMOFO_EXTENDED
              Constant for the "Bopomofo Extended" Unicode character block.

    static Character.UnicodeBlock
    BOX_DRAWING
              Constant for the "Box Drawing" Unicode character block.

    …………

    具體參見(jiàn)java.lang
    Class Character.UnicodeBlock里面的定義。

    8 、java.langClass Class<T>

    這個(gè)類(lèi)的實(shí)力代表了Java運(yùn)行程序中的類(lèi)和接口。Enum是類(lèi),而Annotation是一個(gè)接口。Every array also belongs to a class that is reflected as a Class object that is shared by all arrays with the same element type and number of dimensions.

    Class的對(duì)象在程序中可以獲取類(lèi)的詳細(xì)信息。

    9、Java.lang.Class ClassLoader

    ClassLoader是個(gè)不錯(cuò)的東西,下面是官方文檔的簡(jiǎn)單翻譯和注解:

    1、ClassLoader用于加載類(lèi)對(duì)象。ClassLoader是一個(gè)抽象類(lèi)。給出類(lèi)的二進(jìn)制名字(如“

      "java.lang.String"
       "javax.swing.JSpinner$DefaultEditor"
       "java.security.KeyStore$Builder$FileBuilder$1"
       "java.net.URLClassLoader$3$1"

    ”),ClassLoader會(huì)使用定位和生成類(lèi)。一個(gè)典型的策略就是將二進(jìn)制名字轉(zhuǎn)化為文件名,然后從文件系統(tǒng)中讀取這個(gè)類(lèi)文件。

    每一個(gè)Class對(duì)象都包含了一個(gè)創(chuàng)建它的引用。

    數(shù)組的Class對(duì)象不能由ClassLoader創(chuàng)建,但是可以由Java運(yùn)行時(shí)動(dòng)態(tài)創(chuàng)建。一個(gè)數(shù)組類(lèi)的ClassLoader,和他的元素的ClassLoader是一樣的;如果元素是基本類(lèi)型,則數(shù)組類(lèi)沒(méi)有ClassLoader。

    應(yīng)用程序可以實(shí)現(xiàn)ClassLoader的子類(lèi),來(lái)擴(kuò)展行為。這樣可以在JVM動(dòng)態(tài)的創(chuàng)建類(lèi)。

    ClassLoader主要由安全管理器來(lái)使用,用于保證安全區(qū)域。

    ClassLoader 使用一個(gè)delegation(委托)模型來(lái)搜索類(lèi)和資源。每一個(gè)ClassLoader有一個(gè)相關(guān)的父類(lèi)ClassLoader。當(dāng)請(qǐng)求來(lái)查找一個(gè)資源或者類(lèi)的時(shí)候,ClassLoader 實(shí)例會(huì)委托搜索類(lèi)和資源。

    內(nèi)建的ClassLoader,叫做bootstrap class loader,沒(méi)有父類(lèi)。

    正常的,ClassLoader從本地文件系統(tǒng)中加載數(shù)據(jù)。通過(guò)CLassPath。

    當(dāng)然,也可以通過(guò)NetWork從服務(wù)器上下載字節(jié)碼。來(lái)加載類(lèi):

    ClassLoader loader = new NetworkClassLoader(host, port);
    Object main = loader.loadClass("Main", true).newInstance();
    Network ClassLoader 子類(lèi)必須定義方法FindClass 和loadClassData來(lái)加載來(lái)自互聯(lián)網(wǎng)上的類(lèi)。一旦或得到字節(jié)碼,它使用defineClass方法來(lái)創(chuàng)建類(lèi)實(shí)例。
    class NetworkClassLoader extends ClassLoader {
             String host;
             int port;
    
             public Class findClass(String name) {
                 byte[] b = loadClassData(name);
                 return defineClass(name, b, 0, b.length);
             }
    
             private byte[] loadClassData(String name) {
                 // load the class data from the connection  . . .
             }
         }

    個(gè)人理解:

    ClassLoader是一個(gè)類(lèi)加載器,除了可以從ClassPath加載類(lèi)之外,還可以從ClassPath中加載資源:

    InputStream
    getResourceAsStream(String name)
              Returns an input stream for reading the specified resource.

    Enumeration<URL>
    getResources(String name)
              Finds all the resources with the given name.

    static URL
    getSystemResource(String name)
              Find a resource of the specified name from the search path used to load classes.

    static InputStream
    getSystemResourceAsStream(String name)
              Open for reading, a resource of the specified name from the search path used to load classes.

    static Enumeration<URL>
    getSystemResources(String name)
              Finds all resources of the specified name from the search path used to load classes.

    protected  Class<?>
    findClass(String name)
              Finds the class with the specified binary name.

    10、Compiler類(lèi)3

    編譯類(lèi)是提供給支持Java到本地代碼編譯器和相關(guān)服務(wù)。根據(jù)設(shè)計(jì),編譯器類(lèi)什么都不做;它作為一個(gè)占位符來(lái)為運(yùn)行時(shí)編譯執(zhí)行的技術(shù)。

    當(dāng)JVM第一次啟動(dòng)時(shí),他判斷java.compiler是否存在。如果存在,他3

    posted on 2009-11-16 13:11 追求無(wú)止境 閱讀(144) 評(píng)論(0)  編輯  收藏


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


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲中文字幕久久精品无码VA | 久久精品国产96精品亚洲| 久久综合九色综合97免费下载| 亚洲视频日韩视频| 国产小视频在线观看免费| 水蜜桃视频在线观看免费播放高清 | 抽搐一进一出gif免费视频| 亚洲精品视频在线| 在线观看亚洲免费| 午夜精品一区二区三区免费视频| 亚洲色偷偷偷综合网| 国内精品99亚洲免费高清| 99在线精品视频观看免费| 一级毛片**免费看试看20分钟| 久久亚洲精精品中文字幕| 免费国产精品视频| 91久久青青草原线免费| 夜夜爽妓女8888视频免费观看| 亚洲精品在线免费观看视频| 亚洲免费日韩无码系列 | 永久免费无码网站在线观看| 国产一级在线免费观看| 亚洲中文无码亚洲人成影院| 亚洲av无码国产精品色午夜字幕| 免费国产不卡午夜福在线| 曰批视频免费40分钟试看天天| 一级毛片在线完整免费观看| 精品久久久久久亚洲精品| 亚洲va国产va天堂va久久| 亚洲免费日韩无码系列| 日韩精品视频免费观看| 青娱乐免费在线视频| 精品一卡2卡三卡4卡免费视频| 一级日本高清视频免费观看 | 亚洲av无码无线在线观看| 亚洲第一成年网站大全亚洲| 亚洲中文字幕无码爆乳av中文| 免费看a级黄色片| 免免费国产AAAAA片| 亚在线观看免费视频入口| 日韩免费在线中文字幕|