600 likes | 775 Views
????. ????????????,?????????????Java????????????,????????????????????????????,??Java?????????;?????????????????;???????????????????. ????. Java??????? Java??????? Java??????? Java??????? ?????? ????. 4.1 Java???????. Java??????????????Java?????????????????,??????????????Java??????:???
E N D
1. ???? Java????? ?4? Java???????
2. ????
????????????,?????????????Java????????????,????????????????????
????????,??Java?????????;?????????????????;???????????????????
3. ???? Java???????
Java???????
Java???????
Java???????
??????
????
4. 4.1 Java??????? Java??????????????Java?????????????????,??????????????
Java??????:?????????????????
5. 4.1.1?????4-1? ?????????Java?????
import java.lang // ????????????????????????
// ????????????????(???????)
import java.io.*; // ???????????????????
public class SaleCount extends Object //?????????SaleCount?
{ public static void main(String[] args)
{ //Java?????main()????????
int totalCount; //????
int Count; //????
InputStreamReader stdin=new InputStreamReader(System.in);
//????
BufferedReader bufin=new BufferedReader(stdin);
//????
totalCount=0;
6. ?????????Java?????
try
{ do //????:
{ System.out.println("???????????:"+totalCount+"?");
System.out.print("???????(????????????)");
Count=Integer.parseInt(bufin.readLine());
if(Count<0)
break;
else
totalCount=totalCount+Count;
}while(true);
stdin.close();
bufin.close();
}
catch (IOException E)
{ System.out.println("??I/O??"); }
}
} //??????,????????
7. 4.1.2 ????????? ???4-1:???????
10. 4.1.3 ???? ???????????:
??????????
??:
???????:
????????????????????
???????:
?????????????????????
11. ????
???????????????????????,??????????(?????)???,?????????????
????:
???????????????????,???????????????
???:
???static ??????????????????????????,???????????????????,??????????????,??????????? ????
12. ??????????????:
public, friendly, protected, private, final, static?
(1)public,?????????????????;
(2)friendly,????????????????;
(3)protected,?????????????????
(4)private,?????????????,??????????????,????????????
?????????????????????
(5)final,?????????????????????????????????????,?????????????,?????
????????????????????
(6)static,????????????????????,?????“????”???static???
13. ???4-3:
14. ????
15. ???4-4
16. ???(???????)
?static???????????
(1)main???????,??Java??????,?????????????,??Java?????????
(2)static?????????,??????????????????????;
(3)??static???,???????????,???????????;
(4)static??????static????,?????static????;
(5)static??????static??,?????static??;
(6)static???????,????,????????????????????
17. ???4-5
18. ???????? ??????Java???????,???????????????
?Java?,??????????????,?????????????:
[???] ????? ???(?????)[throw???]
{
????
??????
}
19. 1 ???????? final??????????????,???????????????
native???????????Java????????
abstract?????????????,????????,?????????????????
Synchronized???????????;????????????????????,??????????,???????????,???????,?????????
20. 2 ??????????????? ?????:????????????????????
????:???????????????????????????????????;???????????,??????????????????????????????????,????:
(??????1 ?????1, ??????2 ?????2,……)
throw???:????????????????????????????????????7???????
21. 4.1.4 ???? ?????????????,????????????????????????????,??????????????????????????
????????,??????????????????,????????????????????????????,???????????;??????????(template)?
22. ???? ?——class
????????????,????????????????????(????)??????????????????????????
23. ????? ??——object
24. ????? ??——object
25. ???4-6 ??????:?????1??????Goods?????Show_Goods,????????
public class Show_Goods extends Goods
{ public static void main(String args[])
{ Goods G1; // ????
G1 = new Goods( ) ; // ????,?????????
G1.name = “electrical_equipment ”;
// ?????,?????????
G1.ShowGoods( ); }
// ????????,??????
}
?????????:????,??????????
26. ?????1 ???????????
??:?? ???;
??:Textfield input;
????????
??:new ????(???);
??:new Textfield(10);
?new?????????????
??:?????=new ????(???)
??:input=new Textfield(10); ????????:?? ??? = new ????( );????????????????:?? ??? = new ????( );????????
27. ?????2 ??????
?????3?????:
????????????
<??><???>=new <??>([????])
??:
(1)????:
<??><???>
?:MyBox b1;
(2)???????????
<???>=new <??>( [????] )
?:MyBox b2=new MyBox(20,20,100,100)
28. ?????? ?????????????????????????
???????????????????
(1)???????(0,??,?,?);
(2)????????????
29. ????????
MyBox( )
{ x=0;
y=0;
width=0;
height=0;
}
(??????)
30. ?????1 ??“.”??????????
???.?????=??;
?:???.???=??;
??:Your_Clouth.color= “white”;
//?????????????
Your_Clouth.name= “ ”;
//?????????
??????????????????????
??:???????????setEmpNum(Num);
??????,<??.setEmpNum(1001); >
?????????<??.??Num>????1001?
31. ?????2 ?A?????????B??????,??????
??:?A???=B???????:
?? A=new ??();
?? B=new ??();
A=B;
???????,?????A????????
B??????,????A??????????
??B???????,????????????
?????
32. ?????1 ????
(1)<???>.<???>
(2)<???>.<???>([????])
??:
Graphics g;
g.drawRect (x, y, width, height);
33. ?????2 ????
???????????????????,??????????????????????????,???????==??? if ???????
???????????????????????????(???????????????,??????????????????)?????????????????,???????????equals()?????
34. ?????3 ????????
????????????,??:
int?????????0;
boolean?????????false;
?????????null,??????null?????????????????null?,???????????????????,??????(Null Pointer Exception)?
35. ?????4 ????
??????:
?? ???[ ]; ? ??[ ] ???;
?????????:
???=new ??[???????];
????????????????:
??????????????????????????????????,????????????????????,??????????new??????????
36. ????? ??????????????
??:
Rectangle r=new Rectangle(5,5,5,5);
……
r = null;
37. 4.1.5?????4-2?
42. ??????? ?????(?????)???
??????:
<???????> <?????>
??????:
<?????> // ??????
this . <?????>
????(????)???:
<??>.<????>
??????: <????> // ??????
43. ??????? ??????:
<???>([???]) // ??????
??????:
<???>.<???>([???])
<??>.<???>([???])
??????:
(1)???????????????????
?????????;
(2)???????????????????
??????;
(3)??????????,????????
?????
44. 4.1.6 ??????? ??????????????????,?????????????????
* ???????????,?????????
??(instance);
* ??????????(template)?
45. ??????? ????“is-a(??)”???????
??:
“??????”;
“?????”?
?:???????????????????(??),??????????????
?????????:
??????????,?????????????
46. ???????????
47. ????????????????? 1 ????:
???????????,???????????????????????
2 ??????:
(1)????????:
??.?????? ?? ???.??????
(2)??????????:
???.????????
3 ?????:
(1)???????????????????,????????????????;
(2)???????????????????????????????
4 ?????
(1)?????????;
(2)???????????
48. 4.1.7 ??????????1 ?????
(1)??????????????????,?????????????????
(2)public?????public?????????????????????
(3)final?????final?????????????????????,?????????
(4)abstract?????abstract??????????????????????????,?????????,?????????
49. 4.1.7 ??????????2 ???????
(1)public????
(2)private????
(3)protected????
(4)????(???)?
???????????????:
(1)abstract???final?????????
(2)abstract???private,static,final?native??????????
(3)abstract?????private???(???????)?
(4)abstract????????static???
50. 4.1.8?????4-3?
53. 4.1.9 ?????? ?????????Java?????? ????????,???????,????????,?????????:API---application program interface
SUN ?????????????JFC?
54. ??????? ?????????????????,??import?????????????,?????????????????????????????Java???,????Java?????????????????????
55. ???????????
56. ?????????? 1) java.lang
2) java.lang.reflect
3) java.io
4) java.util
5) java.util.zip
6) java.awt
7) java.awt.image
8) java.awt.datatransfer
9) java.awt.event
57. ?????????? 10) java.applet
11) java.net
12) java.corba
13) java.corba.orb
14) java.rmi
15) java.rmi.reistry
16) java.rmi.server
17) java.security
18) java.security.acl
19) java.security.interfaces
20) java.sql
58. ??java???? ? ??????? ? ???????
java.applet applet java.rmi ??????
java.awt ????????? java.rmi.dgc ??java.rmi
java.awt.datatranster ??????? java.rmi.registry ??
java.awt.event ???? java.rmi.server ??
java.awt.image ???? java.security ??
java.awt.peer ?????? java.security.acl ??java.security
java.beans ???? java.security.interfaces ??
java.io ???? java.sql ???
java.lang ??????? java.text ???
java.lang.reflect ??(“??”) java.util ????
java.math ???????? java.util.zip ??????
java.net ??
59. ??javax???? ? ?????????
javax.accessibility ????
javax.swing “??”????????
javax.swing.border ????
javax.swing.colorchooser ????
javax.swing.event ??java.awt.event?????
javax.swing.filechooser ????
javax.swing.plaf ?????????
javax.swing.plaf.basic ????????
javax.swing.plaf.metal ????????
javax.swing.plaf.multi ?????????
javax.swing.table ???????
javax.swing.text ????????
javax.swing.text.html HTML??
javax.swing.text.rtf RTF(Rich Text Format)??
javax.swing.tree ???????
javax.swing.undo ??????????
60. ???????????? 1 ?????
?:??Java Applet?????Java.applet
?? Applet?????
2 ???????
?:???????????????
System.out.println( )
3 ????????
?:?????????????????
TextField input ?3???,?????????3???,????????