為什么要有內(nèi)部類?

? An inner class is a class that is defined inside another class. Why would you want to do that? There are three reasons:

? Inner class methods can access the data from the scope in which they are defined—including the data that would otherwise be private.

? Inner classes can be hidden from other classes in the same package.

? Anonymous inner classes are handy when you want to define callbacks without writing a lot of code.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,854評(píng)論 0 10
  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 11,112評(píng)論 0 23
  • 我在大洋的一邊,望著看不見的彼岸 你在冬天的雪光中,想烤出夏天的溫暖 他幻想有一雙翅膀飛躍海的寬和時(shí)光的長(zhǎng) 于是我...
    江上漁夫閱讀 234評(píng)論 0 0
  • 請(qǐng)人吃早飯的梁實(shí)秋 文/石巖磊 梁實(shí)秋是我國(guó)近代著名文學(xué)家,他的生活非常有規(guī)律,每天晚上八點(diǎn)休息,第二天早上四點(diǎn)起...
    石巖磊簡(jiǎn)書閱讀 804評(píng)論 2 3
  • 坐上北上的火車,來回奔波與兩個(gè)城市之間已成常態(tài),對(duì)小姨的留戀總是那么多~吃飯之間喝了小酒,導(dǎo)致趕車時(shí)間緊張,...
    胡曉梅閱讀 214評(píng)論 0 0

友情鏈接更多精彩內(nèi)容