ݺߣ

ݺߣShare a Scribd company logo
Java SE Lesson 3

1. ӿķdz󷽷ӿеķ public ġ
2. ӿҲԶԱӿеijԱ publicfinalstatic ġ
3. һ಻ܼ final abstract ġΪ abstract ҪĿǶһԼ
    ȥʵԼ final ʾ಻ܱ̳У abstract ϣ
    ̳ж final ȷ˵಻ܱ̳Уìܡһ಻ܼ final ģ
     abstract ġ
4. Design Patternģʽ         ģʽSingleton       ʾһֻΨһһ
    
5. package     ڽɲͬܵű࣬ڲͬĿ¼¡
           ˾תΪ                www.shengsiyuan.com              
                                                                 com.shengsiyuan
      ڰÿĸҪСдʱûʹ packageô
    Java ΪλĬϰ棨default package                     
6.  package  Java Դļַʽ
a) ֱӱ룬       Ȼİ                һֹĿ¼ṹ           ɵ class
    ļŵĿ¼ṹУʹãȽ鷳                            
b) ʹñ CdʽΪ javac Cd . Դļ.javaڱ󣬱Զ
    ǽðӦĿ¼ṹ
7. ֱ aa.bb.cc  aa.bb.cc.ddôdzƺΪǰߵӰ
8. 루import      ʹ package ĸർñܹҵҪ
    ࡣ
9. import ﷨import com.shengsiyuan.PackageTest;
10. import com.shengsiyuan.*ʾ com.shengsiyuan ࡣ
11. import aa.bb.*ᵼ aa.bb.cc ࡣʱҪд
    import aa.bb.*;
    import aa.bb.cc.*;
12.  packageimportclass ˳⣺
a) Ҫpackage             ѡ
b) ʹ import е룬ѡ
c) Ȼ class  interface Ķ塣
13. ͬһ棬ôҪ룬ֱʹüɡ
14. ηaccess modifier         
1      publicģ      public εԺͷԱʡ
2      protectedܱģ       protected εԺͷڲͬ
        Լʡ
3      private˽еģ      private εԺͷֻڸڲʹ
4      Ĭϵģκηη                 ڲԼͬʹá
15. instanceof жijǷijʵ﷨ʽ instanceof 
    ӿ       һ boolean ֵ
 16. People people = new Man();
17. System.out.println(people instanceof People); //Ϊ true Ϊ Man  People 
    ࣬ݼ̳УǸ࣬ Man ҲԿ People ʵ
18. ԵıȽϣ==
1        ԭ˵ȽϵߵֵǷȡ
2        ˵ȽߵǷָͬһ󣬻˵
          ߵõַǷͬ
19.    java.lang.Object ࡣjava.lang ʹõʱʽ룬ʱɱԶ
      ǵ롣
20.   API Application Programming InterfaceӦñ̽ӿڡ
21.   ӡʱʵϻӡָ toString()ķֵΪÿ
      ඼ֱӻӵؼ̳ Object Object ж toString()ÿ඼
      toString()
22.   ڽƵıʾ16 ƣ 16 һ16 Ƶְ09A,B,C,D,E,F
23.   equals()÷ Object ൱У Java еÿ඼и÷
       Object  equals()˵         жϵ equals()봫
      Ƿһ£Ƿָͬһ󡣶 Object  equals()
      ˵ȼ==
24.    String  equals()˵жϵǰַ봫ַ
      Ƿһ¡
25.    String ж˵ʹ equals()Ҫʹ==
26.   String dzһϾ޷ı䡣ʹ+ƴַʱ
       String 󣬶ԭе String ׷ݡ
27.   String Poolַأ
28.   String s = aaa;ֵʽֵ
1)     String Pool Ƿڡaaaڣ String Pool д
      һaaaȻ String Pool еaaaĵַ
      ñ s s ָ String Pool еaaaַ
2)    ڣ        򲻴κζ        ֱӽ String Pool еaaaַ
       s á
29.   String s = new String(aaa);
1)     String Pool вû         aaa  ַ   У    String Pool
      ȥaaaˣֱڶУheapдһaaaַ
      Ȼ󽫶еaaaĵַ s ã s ָ˶
      aaaַ
2)    ûУ String Pool дһaaaȻڶУheap
      һaaaȻ󽫶еaaaĵַ s ã
       s ָ˶aaa

More Related Content

What's hot (14)

Python 3.5 gփԡ²ݸ
Python 3.5 gփԡ²ݸPython 3.5 gփԡ²ݸ
Python 3.5 gփԡ²ݸ
Justin Lin
?
Justin Lin
?
Java SE 7 gփͶӰƬ 09 - CollectioncMap
Java SE 7 gփͶӰƬ 09  - CollectioncMapJava SE 7 gփͶӰƬ 09  - CollectioncMap
Java SE 7 gփͶӰƬ 09 - CollectioncMap
Justin Lin
?
Java SE 7 gփԵڶ²ݸ - JDK IDE
Java SE 7 gփԵڶ²ݸ -  JDK  IDEJava SE 7 gփԵڶ²ݸ -  JDK  IDE
Java SE 7 gփԵڶ²ݸ - JDK IDE
Justin Lin
?
2011Y܌Wgv Java-Object
2011Y܌Wgv Java-Object2011Y܌Wgv Java-Object
2011Y܌Wgv Java-Object
Veck Hsiao
?
Justin Lin
?
Java SE 7 gփԵ²ݸ - ^^У
Java SE 7 gփԵ²ݸ - ^^УJava SE 7 gփԵ²ݸ - ^^У
Java SE 7 gփԵ²ݸ - ^^У
Justin Lin
?
04ʶ
04ʶ04ʶ
04ʶ
Justin Lin
?
װ
װװ
װ
Justin Lin
?
[ʥ˼԰][Java SE]Reflection
[ʥ˼԰][Java SE]Reflection[ʥ˼԰][Java SE]Reflection
[ʥ˼԰][Java SE]Reflection
ArBing Xie
?
뽻뽻
Justin Lin
?
Java SE 8 gփԵ 17 -
Java SE 8 gփԵ 17  - Java SE 8 gփԵ 17  -
Java SE 8 gփԵ 17 -
Justin Lin
?
ģ鵽
ģ鵽ģ鵽
ģ鵽
Justin Lin
?

Viewers also liked (11)

MercadoMercado
Mercado
Francisco Lozano Padua
?
Letter Parts
Letter PartsLetter Parts
Letter Parts
Kay Masters
?
Pankkk 2010 prez_artisjus
Pankkk 2010 prez_artisjusPankkk 2010 prez_artisjus
Pankkk 2010 prez_artisjus
Peter Benjamin Toth
?
A vlasztsi kampnyok nemzetk?zi jellege s magyar sajtossgai2
A vlasztsi kampnyok nemzetk?zi jellege s magyar sajtossgai2A vlasztsi kampnyok nemzetk?zi jellege s magyar sajtossgai2
A vlasztsi kampnyok nemzetk?zi jellege s magyar sajtossgai2
szegedbtk
?
Addwallet
AddwalletAddwallet
Addwallet
surfingrainbows
?
[ʥ˼԰][Java SE]Java se lesson 8
[ʥ˼԰][Java SE]Java se lesson 8[ʥ˼԰][Java SE]Java se lesson 8
[ʥ˼԰][Java SE]Java se lesson 8
ArBing Xie
?
Proyecto ITERProyecto ITER
Proyecto ITER
guestaafedf7
?
Plants that have changed the world
Plants that have changed the worldPlants that have changed the world
Plants that have changed the world
carissaf
?
Celula division parte 2Celula division parte 2
Celula division parte 2
ivgd
?
A vlasztsi kampnyok nemzetk?zi jellege s magyar sajtossgai2
A vlasztsi kampnyok nemzetk?zi jellege s magyar sajtossgai2A vlasztsi kampnyok nemzetk?zi jellege s magyar sajtossgai2
A vlasztsi kampnyok nemzetk?zi jellege s magyar sajtossgai2
szegedbtk
?
[ʥ˼԰][Java SE]Java se lesson 8
[ʥ˼԰][Java SE]Java se lesson 8[ʥ˼԰][Java SE]Java se lesson 8
[ʥ˼԰][Java SE]Java se lesson 8
ArBing Xie
?
Proyecto ITERProyecto ITER
Proyecto ITER
guestaafedf7
?
Plants that have changed the world
Plants that have changed the worldPlants that have changed the world
Plants that have changed the world
carissaf
?
Celula division parte 2Celula division parte 2
Celula division parte 2
ivgd
?

Similar to [ʥ˼԰][Java SE]Java se lesson 3 (20)

[ʥ˼԰][Java SE]Java se lesson 1
[ʥ˼԰][Java SE]Java se lesson 1[ʥ˼԰][Java SE]Java se lesson 1
[ʥ˼԰][Java SE]Java se lesson 1
ArBing Xie
?
Javaơĩ ()
Javaơĩ ()Javaơĩ ()
Javaơĩ ()
jane2006
?
ı
ıı
ı
wavefly
?
GDSC FCU 2 Kotlin
GDSC FCU 2 KotlinGDSC FCU 2 Kotlin
GDSC FCU 2 Kotlin
FCUGDSC
?
[ʥ˼԰][Java SE]Java se lesson 5
[ʥ˼԰][Java SE]Java se lesson 5[ʥ˼԰][Java SE]Java se lesson 5
[ʥ˼԰][Java SE]Java se lesson 5
ArBing Xie
?
Collection
CollectionCollection
Collection
Medivh2011
?
[ʥ˼԰][Java SE]Java se lesson 15
[ʥ˼԰][Java SE]Java se lesson 15[ʥ˼԰][Java SE]Java se lesson 15
[ʥ˼԰][Java SE]Java se lesson 15
ArBing Xie
?
2, object oriented programming
2, object oriented programming2, object oriented programming
2, object oriented programming
ted-xu
?
ڶ
ڶڶ
ڶ
?
Abap oo
Abap ooAbap oo
Abap oo
vernoo
?
ϡ¼ģʽԭ
ϡ¼ģʽԭϡ¼ģʽԭ
ϡ¼ģʽԭ
޳-̳
?

More from ArBing Xie (20)

[ʥ˼԰][Java SE]Swing
[ʥ˼԰][Java SE]Swing[ʥ˼԰][Java SE]Swing
[ʥ˼԰][Java SE]Swing
ArBing Xie
?
[ʥ˼԰][Java SE]Websphere.application.developer(wsad)ʹwin cvs
[ʥ˼԰][Java SE]Websphere.application.developer(wsad)ʹwin cvs[ʥ˼԰][Java SE]Websphere.application.developer(wsad)ʹwin cvs
[ʥ˼԰][Java SE]Websphere.application.developer(wsad)ʹwin cvs
ArBing Xie
?
[ʥ˼԰][Java SE]Strategy
[ʥ˼԰][Java SE]Strategy[ʥ˼԰][Java SE]Strategy
[ʥ˼԰][Java SE]Strategy
ArBing Xie
?
[ʥ˼԰][Java SE]Ooaduml lesson 2
[ʥ˼԰][Java SE]Ooaduml lesson 2[ʥ˼԰][Java SE]Ooaduml lesson 2
[ʥ˼԰][Java SE]Ooaduml lesson 2
ArBing Xie
?
[ʥ˼԰][Java SE]Observer
[ʥ˼԰][Java SE]Observer[ʥ˼԰][Java SE]Observer
[ʥ˼԰][Java SE]Observer
ArBing Xie
?
[ʥ˼԰][Java SE]Network
[ʥ˼԰][Java SE]Network[ʥ˼԰][Java SE]Network
[ʥ˼԰][Java SE]Network
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 22
[ʥ˼԰][Java SE]Java se lesson 22[ʥ˼԰][Java SE]Java se lesson 22
[ʥ˼԰][Java SE]Java se lesson 22
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 21
[ʥ˼԰][Java SE]Java se lesson 21[ʥ˼԰][Java SE]Java se lesson 21
[ʥ˼԰][Java SE]Java se lesson 21
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 20
[ʥ˼԰][Java SE]Java se lesson 20[ʥ˼԰][Java SE]Java se lesson 20
[ʥ˼԰][Java SE]Java se lesson 20
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 17
[ʥ˼԰][Java SE]Java se lesson 17[ʥ˼԰][Java SE]Java se lesson 17
[ʥ˼԰][Java SE]Java se lesson 17
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 16
[ʥ˼԰][Java SE]Java se lesson 16[ʥ˼԰][Java SE]Java se lesson 16
[ʥ˼԰][Java SE]Java se lesson 16
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 13
[ʥ˼԰][Java SE]Java se lesson 13[ʥ˼԰][Java SE]Java se lesson 13
[ʥ˼԰][Java SE]Java se lesson 13
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 12
[ʥ˼԰][Java SE]Java se lesson 12[ʥ˼԰][Java SE]Java se lesson 12
[ʥ˼԰][Java SE]Java se lesson 12
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 11
[ʥ˼԰][Java SE]Java se lesson 11[ʥ˼԰][Java SE]Java se lesson 11
[ʥ˼԰][Java SE]Java se lesson 11
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 10
[ʥ˼԰][Java SE]Java se lesson 10[ʥ˼԰][Java SE]Java se lesson 10
[ʥ˼԰][Java SE]Java se lesson 10
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 4
[ʥ˼԰][Java SE]Java se lesson 4[ʥ˼԰][Java SE]Java se lesson 4
[ʥ˼԰][Java SE]Java se lesson 4
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 2
[ʥ˼԰][Java SE]Java se lesson 2[ʥ˼԰][Java SE]Java se lesson 2
[ʥ˼԰][Java SE]Java se lesson 2
ArBing Xie
?
[ʥ˼԰][Java SE]Io 3
[ʥ˼԰][Java SE]Io 3[ʥ˼԰][Java SE]Io 3
[ʥ˼԰][Java SE]Io 3
ArBing Xie
?
[ʥ˼԰][Java SE]Io 1
[ʥ˼԰][Java SE]Io 1[ʥ˼԰][Java SE]Io 1
[ʥ˼԰][Java SE]Io 1
ArBing Xie
?
[ʥ˼԰][Java SE]Inner class
[ʥ˼԰][Java SE]Inner class[ʥ˼԰][Java SE]Inner class
[ʥ˼԰][Java SE]Inner class
ArBing Xie
?
[ʥ˼԰][Java SE]Swing
[ʥ˼԰][Java SE]Swing[ʥ˼԰][Java SE]Swing
[ʥ˼԰][Java SE]Swing
ArBing Xie
?
[ʥ˼԰][Java SE]Websphere.application.developer(wsad)ʹwin cvs
[ʥ˼԰][Java SE]Websphere.application.developer(wsad)ʹwin cvs[ʥ˼԰][Java SE]Websphere.application.developer(wsad)ʹwin cvs
[ʥ˼԰][Java SE]Websphere.application.developer(wsad)ʹwin cvs
ArBing Xie
?
[ʥ˼԰][Java SE]Strategy
[ʥ˼԰][Java SE]Strategy[ʥ˼԰][Java SE]Strategy
[ʥ˼԰][Java SE]Strategy
ArBing Xie
?
[ʥ˼԰][Java SE]Ooaduml lesson 2
[ʥ˼԰][Java SE]Ooaduml lesson 2[ʥ˼԰][Java SE]Ooaduml lesson 2
[ʥ˼԰][Java SE]Ooaduml lesson 2
ArBing Xie
?
[ʥ˼԰][Java SE]Observer
[ʥ˼԰][Java SE]Observer[ʥ˼԰][Java SE]Observer
[ʥ˼԰][Java SE]Observer
ArBing Xie
?
[ʥ˼԰][Java SE]Network
[ʥ˼԰][Java SE]Network[ʥ˼԰][Java SE]Network
[ʥ˼԰][Java SE]Network
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 22
[ʥ˼԰][Java SE]Java se lesson 22[ʥ˼԰][Java SE]Java se lesson 22
[ʥ˼԰][Java SE]Java se lesson 22
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 21
[ʥ˼԰][Java SE]Java se lesson 21[ʥ˼԰][Java SE]Java se lesson 21
[ʥ˼԰][Java SE]Java se lesson 21
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 20
[ʥ˼԰][Java SE]Java se lesson 20[ʥ˼԰][Java SE]Java se lesson 20
[ʥ˼԰][Java SE]Java se lesson 20
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 17
[ʥ˼԰][Java SE]Java se lesson 17[ʥ˼԰][Java SE]Java se lesson 17
[ʥ˼԰][Java SE]Java se lesson 17
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 16
[ʥ˼԰][Java SE]Java se lesson 16[ʥ˼԰][Java SE]Java se lesson 16
[ʥ˼԰][Java SE]Java se lesson 16
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 13
[ʥ˼԰][Java SE]Java se lesson 13[ʥ˼԰][Java SE]Java se lesson 13
[ʥ˼԰][Java SE]Java se lesson 13
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 12
[ʥ˼԰][Java SE]Java se lesson 12[ʥ˼԰][Java SE]Java se lesson 12
[ʥ˼԰][Java SE]Java se lesson 12
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 11
[ʥ˼԰][Java SE]Java se lesson 11[ʥ˼԰][Java SE]Java se lesson 11
[ʥ˼԰][Java SE]Java se lesson 11
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 10
[ʥ˼԰][Java SE]Java se lesson 10[ʥ˼԰][Java SE]Java se lesson 10
[ʥ˼԰][Java SE]Java se lesson 10
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 4
[ʥ˼԰][Java SE]Java se lesson 4[ʥ˼԰][Java SE]Java se lesson 4
[ʥ˼԰][Java SE]Java se lesson 4
ArBing Xie
?
[ʥ˼԰][Java SE]Java se lesson 2
[ʥ˼԰][Java SE]Java se lesson 2[ʥ˼԰][Java SE]Java se lesson 2
[ʥ˼԰][Java SE]Java se lesson 2
ArBing Xie
?
[ʥ˼԰][Java SE]Io 3
[ʥ˼԰][Java SE]Io 3[ʥ˼԰][Java SE]Io 3
[ʥ˼԰][Java SE]Io 3
ArBing Xie
?
[ʥ˼԰][Java SE]Io 1
[ʥ˼԰][Java SE]Io 1[ʥ˼԰][Java SE]Io 1
[ʥ˼԰][Java SE]Io 1
ArBing Xie
?
[ʥ˼԰][Java SE]Inner class
[ʥ˼԰][Java SE]Inner class[ʥ˼԰][Java SE]Inner class
[ʥ˼԰][Java SE]Inner class
ArBing Xie
?

[ʥ˼԰][Java SE]Java se lesson 3

  • 1. Java SE Lesson 3 1. ӿķdz󷽷ӿеķ public ġ 2. ӿҲԶԱӿеijԱ publicfinalstatic ġ 3. һ಻ܼ final abstract ġΪ abstract ҪĿǶһԼ ȥʵԼ final ʾ಻ܱ̳У abstract ϣ ̳ж final ȷ˵಻ܱ̳Уìܡһ಻ܼ final ģ abstract ġ 4. Design Patternģʽ ģʽSingleton ʾһֻΨһһ 5. package ڽɲͬܵű࣬ڲͬĿ¼¡ ˾תΪ www.shengsiyuan.com com.shengsiyuan ڰÿĸҪСдʱûʹ packageô Java ΪλĬϰ棨default package 6. package Java Դļַʽ a) ֱӱ룬 Ȼİ һֹĿ¼ṹ ɵ class ļŵĿ¼ṹУʹãȽ鷳 b) ʹñ CdʽΪ javac Cd . Դļ.javaڱ󣬱Զ ǽðӦĿ¼ṹ 7. ֱ aa.bb.cc aa.bb.cc.ddôdzƺΪǰߵӰ 8. 루import ʹ package ĸർñܹҵҪ ࡣ 9. import ﷨import com.shengsiyuan.PackageTest; 10. import com.shengsiyuan.*ʾ com.shengsiyuan ࡣ 11. import aa.bb.*ᵼ aa.bb.cc ࡣʱҪд import aa.bb.*; import aa.bb.cc.*; 12. packageimportclass ˳⣺ a) Ҫpackage ѡ b) ʹ import е룬ѡ c) Ȼ class interface Ķ塣 13. ͬһ棬ôҪ룬ֱʹüɡ 14. ηaccess modifier 1 publicģ public εԺͷԱʡ 2 protectedܱģ protected εԺͷڲͬ Լʡ 3 private˽еģ private εԺͷֻڸڲʹ 4 Ĭϵģκηη ڲԼͬʹá 15. instanceof жijǷijʵ﷨ʽ instanceof ӿ һ boolean ֵ 16. People people = new Man(); 17. System.out.println(people instanceof People); //Ϊ true Ϊ Man People ࣬ݼ̳УǸ࣬ Man ҲԿ People ʵ 18. ԵıȽϣ==
  • 2. 1 ԭ˵ȽϵߵֵǷȡ 2 ˵ȽߵǷָͬһ󣬻˵ ߵõַǷͬ 19. java.lang.Object ࡣjava.lang ʹõʱʽ룬ʱɱԶ ǵ롣 20. API Application Programming InterfaceӦñ̽ӿڡ 21. ӡʱʵϻӡָ toString()ķֵΪÿ ඼ֱӻӵؼ̳ Object Object ж toString()ÿ඼ toString() 22. ڽƵıʾ16 ƣ 16 һ16 Ƶְ09A,B,C,D,E,F 23. equals()÷ Object ൱У Java еÿ඼и÷ Object equals()˵ жϵ equals()봫 Ƿһ£Ƿָͬһ󡣶 Object equals() ˵ȼ== 24. String equals()˵жϵǰַ봫ַ Ƿһ¡ 25. String ж˵ʹ equals()Ҫʹ== 26. String dzһϾ޷ı䡣ʹ+ƴַʱ String 󣬶ԭе String ׷ݡ 27. String Poolַأ 28. String s = aaa;ֵʽֵ 1) String Pool Ƿڡaaaڣ String Pool д һaaaȻ String Pool еaaaĵַ ñ s s ָ String Pool еaaaַ 2) ڣ 򲻴κζ ֱӽ String Pool еaaaַ s á 29. String s = new String(aaa); 1) String Pool вû aaa ַ У String Pool ȥaaaˣֱڶУheapдһaaaַ Ȼ󽫶еaaaĵַ s ã s ָ˶ aaaַ 2) ûУ String Pool дһaaaȻڶУheap һaaaȻ󽫶еaaaĵַ s ã s ָ˶aaa