? 1???㈠??瀵硅薄???瑰?????浜??归????
(1).?借薄锛?
?借薄灏辨??蹇界?ヤ?涓?涓婚?涓?涓?褰??????????崇???d??归???浠ヤ究?村?????版敞??涓?褰??????????崇???归?????借薄骞朵???绠?浜?瑙e?ㄩ?ㄩ??棰?锛??????????╁?朵腑??涓??ㄥ??锛????朵??ㄩ?ㄥ??缁??????借薄????涓や釜?归???涓???杩?绋??借薄锛?浜????版???借薄??
(2).缁ф?匡?
缁ф?挎??涓?绉???缁?绫荤??灞?娆℃ā??锛?骞朵???璁稿??榧??辩被???????瀹???渚?浜?涓?绉???纭?琛ㄨ堪?辨?х???规???瀵硅薄??涓?涓??扮被??浠ヤ??版????绫讳腑娲剧??锛?杩?涓?杩?绋?绉颁负绫荤户?裤???扮被缁ф?夸???濮?绫荤???规?э??扮被绉颁负??濮?绫荤??娲剧??绫伙?瀛?绫伙?锛?????濮?绫荤О涓烘?扮被???虹被锛??剁被锛???娲剧??绫诲??浠ヤ?瀹????虹被?i??缁ф?挎?规???瀹?渚?????锛?骞朵?绫诲??浠ヤ慨?规??澧????扮???规?浣夸??撮?????规??????瑕???
(3).灏?瑁?锛?
灏?瑁?????杩?绋????版?????磋捣?ワ?瀵规?版????璁块?????介??杩?宸插??涔??????????㈠??瀵硅薄璁$??濮?浜?杩?涓??烘??姒?蹇碉??崇?板??涓?????浠ヨ???缁???涓?绯诲??瀹??ㄨ??娌汇??灏?瑁???瀵硅薄锛?杩?浜?瀵硅薄??杩?涓?涓???淇??ょ???ュ?h?块???朵?瀵硅薄??
(4). 澶????э?
澶????ф??????璁镐???绫荤??瀵硅薄瀵瑰??涓?娑???浣??哄??搴???澶????у???????板??澶????у??????澶????с??澶????ц??瑷??锋???垫椿???借薄??琛?涓哄?变韩??浠g???变韩??浼??匡?寰?濂界??瑙e?充?搴??ㄧ?搴??芥?板??????棰??? 2 ??String?????烘?????版??绫诲?????
?烘???版??绫诲??????byte??int??char??long??float??double??boolean??short??
java.lang.String绫绘??final绫诲????锛???姝や???浠ョ户?胯?涓?绫汇??涓??戒慨?硅?涓?绫汇??涓轰???楂?????????绌洪?达???浠?搴?璇ョ??tringBuffer绫?3??int ?? Integer ??浠?涔??哄??
Java ??渚?涓ょ?涓?????绫诲??锛?寮??ㄧ被??????濮?绫诲??锛?????缃?绫诲??锛???Int??java????濮??版??绫诲??锛?Integer??java涓?nt??渚???灏?瑁?绫汇??Java涓烘??涓???濮?绫诲????渚?浜?灏?瑁?绫汇??
??濮?绫诲??灏?瑁?绫?booleanBoolean
charCharacter
byteByte
shortShort
intInteger
longLong
floatFloat
doubleDouble
寮??ㄧ被??????濮?绫诲????琛?涓哄???ㄤ???锛?骞朵?瀹?浠??锋??涓?????璇?涔???寮??ㄧ被??????濮?绫诲???锋??涓??????瑰????ㄦ?锛?瀹?浠?????锛?澶у?????搴???棰?锛?杩?绉?绫诲??浠ュ??绉?绫诲?????版??缁???瀛????褰?寮??ㄧ被??????濮?绫诲???ㄤ???涓?绫荤??瀹?渚??版???舵????瀹???缂虹???笺??瀵硅薄寮??ㄥ??渚???????缂虹???间负 null锛?????濮?绫诲??瀹?渚???????缂虹???间?瀹?浠???绫诲?????炽??
4??String ??StringBuffer???哄??
JAVA骞冲?版??渚?浜?涓や釜绫伙?String??StringBuffer锛?瀹?浠???浠ュ?ㄥ??????浣?瀛?绗?覆锛??冲????澶?涓?瀛?绗???瀛?绗??版????杩?涓?String绫绘??渚?浜??板?间????瑰????瀛?绗?覆????杩?涓?StringBuffer绫绘??渚???瀛?绗?覆杩?琛?淇??广??褰?浣??ラ??瀛?绗??版??瑕??瑰?????跺??浣?灏卞??浠ヤ娇??tringBuffer???稿???帮?浣???浠ヤ娇??tringBuffers?ュ?ㄦ??????瀛?绗??版????
5??杩?琛??跺?甯镐?涓???寮?甯告??浣?寮???锛?
寮?甯歌〃绀虹?搴?杩?琛?杩?绋?涓????藉?虹?扮????姝e父?舵??锛?杩?琛??跺?甯歌〃绀鸿?????虹????甯告??浣?涓????介???扮??寮?甯革???涓?绉?甯歌?杩?琛???璇???java缂?璇??ㄨ?姹??规?蹇?椤诲0?????哄???藉????????杩?琛??跺?甯革?浣???骞朵?瑕?姹?蹇?椤诲0?????烘??琚????风??杩?琛??跺?甯搞??
6??璇村??ervlet?????藉?ㄦ??锛?骞惰?村??ervlet??CGI???哄????
Servlet琚????″?ㄥ??渚?????锛?瀹瑰?ㄨ?琛???nit?规?锛?璇锋??拌揪?惰?琛???ervice?规?锛?service?规????ㄦ淳?h?琛?涓?璇锋?瀵瑰???doXXX?规?锛?doGet锛?doPost锛?绛?锛?褰????″?ㄥ?冲??灏?瀹?渚???姣????跺??璋??ㄥ??estroy?规???
涓?cgi???哄???ㄤ?servlet澶?浜????″?ㄨ?绋?涓?锛?瀹???杩?澶?绾跨??瑰?杩?琛???ervice?规?锛?涓?涓?瀹?渚???浠ユ???′?澶?涓?璇锋?锛?骞朵??跺??渚?涓???涓?浼???姣?锛???CGI瀵规??涓?璇锋??戒骇???扮??杩?绋?锛????″??????灏遍??姣?锛???浠ユ????涓?浣?浜?servlet??
7??璇村??rrayList,Vector, LinkedList??瀛??ㄦ?ц?藉???规??ArrayList??Vector?芥??浣跨?ㄦ?扮??瑰?瀛??ㄦ?版??锛?姝ゆ?扮???绱??板ぇ浜?瀹???瀛??ㄧ???版??浠ヤ究澧????????ュ??绱?锛?瀹?浠??藉??璁哥?存?ユ??搴??风储寮???绱?锛?浣??????ュ??绱?瑕?娑????扮???绱?绉诲?ㄧ????瀛???浣?锛???浠ョ储寮??版??蹇??????ユ?版?????Vector?变?浣跨?ㄤ?synchronized?规?锛?绾跨?瀹????锛???甯告?ц?戒?杈?ArrayList宸?锛???LinkedList浣跨?ㄥ?????捐〃瀹??板???????搴??风储寮??版????瑕?杩?琛???????????????锛?浣??????ユ?版???跺????瑕?璁板???椤圭??????椤瑰?冲??锛???浠ユ???ラ??搴??蹇???
8??EJB???轰???浜?????瀹??扮??锛?骞惰?村??essionBean??EntityBean???哄??锛?StatefulBean??StatelessBean???哄????
??? EJB????Session Bean??Entity Bean??Message Driven Bean锛??轰?JNDI??RMI??JAT绛?????瀹??般??
SessionBean??2EE搴??ㄧ?搴?涓?琚??ㄦ?ュ????涓?浜????″?ㄧ????涓??℃??浣?锛?渚?濡?璁块???版??搴???璋??ㄥ?朵?EJB缁?浠躲??EntityBean琚??ㄦ?ヤ唬琛ㄥ??ㄧ郴缁?涓??ㄥ?扮???版????
瀵逛?瀹㈡?锋?猴?SessionBean??涓?绉?????涔??у?硅薄锛?瀹?瀹??版??浜??ㄦ???″?ㄤ?杩?琛???涓??¢?昏???
瀵逛?瀹㈡?锋?猴?EntityBean??涓?绉???涔??у?硅薄锛?瀹?浠h〃涓?涓?瀛??ㄥ?ㄦ??涔??у???ㄥ?ㄤ腑??瀹?浣???瀵硅薄瑙??撅?????涓?涓??辩?版??浼?涓?搴??ㄧ?搴?瀹??扮??瀹?浣???
Session Bean 杩???浠ュ??缁???涓?Stateful Session Bean 涓? Stateless Session Bean 锛?杩?涓ょ??? Session Bean?藉??浠ュ?绯荤??昏??惧??method涔?涓??ц?锛?涓??????? Stateful Session Bean ??浠ヨ?板??煎???????舵??锛???姝ら??甯告?ヨ?达?涓?涓?浣跨?ㄨ??浼???涓?涓??稿?瑰??? Stateful Session Bean ??瀹?浣???Stateless Session Bean ?界?朵????昏?缁?浠讹?浣???浠??翠?璐?璐h?板?浣跨?ㄨ???舵??锛?涔?灏辨??璇村?浣跨?ㄨ???煎?? Stateless Session Bean ???跺??锛?EJB Container 骞朵?浼??惧?荤?瑰???? Stateless Session Bean ??瀹?浣??ユ?ц?杩?涓? method???㈣?涔?锛?寰????芥?颁釜浣跨?ㄨ???ㄦ?ц???涓? Stateless Session Bean ?? methods ?讹?浼?????涓?涓? Bean ?? Instance ?ㄦ?ц???浠???瀛??归?㈡?ョ??锛? Stateful Session Bean 涓? Stateless Session Bean 姣?杈?锛? Stateful Session Bean 浼?娑??? J2EE Server 杈?澶?????瀛?锛??惰?? Stateful Session Bean ??浼??垮?村?ㄤ?浠???浠ョ淮??浣跨?ㄨ?????舵????
9??Collection ?? Collections???哄????
????Collection??????绫荤??涓?绾ф?ュ?o?缁ф?夸?浠????ュ?d富瑕???Set ??List.
Collections????瀵归????绫荤??涓?涓?甯??╃被锛?浠???渚?涓?绯诲???????规?瀹??板?瑰??绉?????????绱?????搴???绾跨?瀹??ㄥ??绛???浣???
10??&??&&???哄????
??? &??浣?杩?绠?绗??琛ㄧず??浣?涓?杩?绠?锛?&&???昏?杩?绠?绗??琛ㄧず?昏?涓?锛?and锛???
11??HashMap??Hashtable???哄????
??? HashMap??Hashtable??杞婚??绾у???帮???绾跨?瀹??ㄧ??瀹??帮?锛?浠?浠??藉????浜?Map?ュ?o?涓昏??哄???ㄤ?HashMap??璁哥┖锛?null锛????硷?key锛?,?变???绾跨?瀹????????涓????介??浜?Hashtable??
HashMap??璁稿?null浣?涓轰?涓?entry??key????value锛???Hashtable涓???璁搞??
HashMap??Hashtable??contains?规??绘??浜?锛??规??containsvalue??containsKey????涓?ontains?规?瀹规??璁╀汉寮?璧疯??瑙c??
Hashtable缁ф?胯??Dictionary绫伙???HashMap??Java1.2寮?杩???Map interface??涓?涓?瀹??般??
??澶х??涓?????锛?Hashtable???规???Synchronize??锛???HashMap涓???锛??ㄥ?涓?绾跨?璁块??Hashtable?讹?涓???瑕???宸变负瀹????规?瀹??板??姝ワ???HashMap 灏卞?椤讳负涔???渚?澶???姝ャ??
Hashtable??HashMap???ㄧ??hash/rehash绠?娉??藉ぇ姒?涓??凤???浠ユ?ц?戒?浼???寰?澶х??宸?寮???
12??final, finally, finalize???哄????
????final ?ㄤ?澹版??灞??э??规???绫伙?????琛ㄧず灞??т?????锛??规?涓???瑕???锛?绫讳???缁ф?裤??
finally??寮?甯稿???璇??ョ?????涓??ㄥ??锛?琛ㄧず?绘???ц???
finalize??Object绫荤??涓?涓??规?锛??ㄥ???炬?堕???ㄦ?ц????跺??浼?璋??ㄨ????跺?硅薄??姝ゆ?规?锛???浠ヨ???姝ゆ?规???渚????炬?堕???剁???朵?璧?婧????讹?渚?濡??抽????浠剁????
13??sleep() ?? wait() ??浠?涔??哄???
??? sleep??绾跨?绫伙?Thread锛????规?锛?瀵艰?存?ょ嚎绋??????ц???瀹??堕?达?缁??ц??轰?缁??朵?绾跨?锛?浣??????х?舵??渚??朵???锛??版?跺??浼????ㄦ?㈠???璋???leep涓?浼????惧?硅薄????
wait??Object绫荤???规?锛?瀵规?ゅ?硅薄璋???ait?规?瀵艰?存??绾跨??惧?瀵硅薄??锛?杩??ョ??寰?姝ゅ?硅薄??绛?寰???瀹?姹?锛???????瀵规?ゅ?硅薄????otify?规?锛???notifyAll锛?????绾跨???杩??ュ?硅薄??瀹?姹???澶??峰?瀵硅薄??杩??ヨ?琛??舵????
14??Overload??Override???哄????Overloaded???规???????浠ユ?瑰??杩????肩??绫诲???
?规???????Overriding????杞?verloading??Java澶????х??涓???琛ㄧ?般??????Overriding???剁被涓?瀛?绫讳??村????х??涓?绉?琛ㄧ?帮???杞?verloading??涓?涓?绫讳腑澶????х??涓?绉?琛ㄧ?般??濡????ㄥ??绫讳腑瀹?涔????规?涓??剁?剁被???稿??????绉板?????帮???浠?璇磋?ユ?规?琚????? (Overriding)??瀛?绫荤??瀵硅薄浣跨?ㄨ?涓??规??讹?灏?璋??ㄥ??绫讳腑??瀹?涔?锛?瀵瑰????瑷?锛??剁被涓???瀹?涔?濡???琚?"灞???浜???濡????ㄤ?涓?绫讳腑瀹?涔?浜?澶?涓????????规?锛?瀹?浠?????涓????????颁釜?版????涓????????扮被??锛???绉颁负?规?????杞?Overloading)??Overloaded???规?????浠ユ?瑰??杩????肩??绫诲????
15??error??exception??浠?涔??哄???
error 琛ㄧず?㈠?涓???涓????戒?寰??伴?剧?????典???涓?绉?涓ラ????棰???姣?濡?璇村??瀛?婧㈠?恒??涓????芥????绋?搴??藉???杩??风?????点??
??? exception 琛ㄧず涓?绉?璁捐?℃??瀹??伴??棰???涔?灏辨??璇达?瀹?琛ㄧず濡???绋?搴?杩?琛?姝e父锛?浠?涓?浼??????????点??
16????姝ュ??寮?姝ユ??浣?寮???锛??ㄤ?涔????典?????浣跨?ㄤ?浠?锛?涓句?璇存????
濡????版??灏??ㄧ嚎绋??村?变韩??渚?濡?姝e?ㄥ?????版??浠ュ?????借????涓?绾跨?璇诲?帮?????姝e?ㄨ?荤???版?????藉凡缁?琚????涓?绾跨???杩?浜?锛??d?杩?浜??版??灏辨???变韩?版??锛?蹇?椤昏?琛???姝ュ??????
褰?搴??ㄧ?搴??ㄥ?硅薄涓?璋??ㄤ?涓?涓???瑕??辫垂寰??挎?堕?存?ユ?ц????规?锛?骞朵?涓?甯???璁╃?搴?绛?寰??规???杩????讹?灏卞?璇ヤ娇?ㄥ?姝ョ?绋?锛??ㄥ?澶????典????ㄥ?姝ラ??寰?寰?寰??存????????
17??abstract class??interface??浠?涔??哄???
澹版???规???瀛??ㄨ??涓??诲???板????绫昏??????借薄绫伙?abstract class锛?锛?瀹??ㄤ?瑕???寤轰?涓?浣??版??浜??烘??琛?涓虹??绫伙?骞朵负璇ョ被澹版???规?锛?浣?涓??藉?ㄨ?ョ被涓?瀹??拌?ョ被?????点??涓??藉??寤?bstract 绫荤??瀹?渚????惰????浠ュ??寤轰?涓?????锛??剁被????涓?涓??借薄绫伙?骞惰?╁???????蜂?瀛?绫荤??涓?涓?瀹?渚???涓??芥???借薄?????芥?版???借薄?????规???Abstract 绫荤??瀛?绫讳负瀹?浠??剁被涓????????借薄?规???渚?瀹??帮?????瀹?浠?涔????借薄绫讳负??????浠d?锛??ㄥ??绫讳腑瀹??拌?ユ?规????ラ???惰?涓虹???跺??绫诲??浠ュ?ㄧ被涓?瀹??拌?浜??规???
?ュ?o?interface锛????借薄绫荤????浣????ㄦ?ュ?d腑锛??????规??芥???借薄????澶?缁ф?挎?у????杩?瀹??拌??风???ュ?h???峰????ュ?d腑???????规??芥???借薄??锛?娌℃??涓?涓???绋?搴?浣????ュ?e????浠ュ??涔?static final???????????ュ?g??瀹??颁?瀛?绫荤?镐技锛??や?璇ュ???扮被涓??戒??ュ?e??涔?涓?缁ф?胯?涓恒??褰?绫诲???扮?规???ュ?f?讹?瀹?瀹?涔?锛??冲?绋?搴?浣?缁?浜?锛?????杩?绉??ュ?g???规????跺??锛?瀹???浠ュ?ㄥ???颁?璇ユ?ュ?g??绫荤??浠讳?瀵硅薄涓?璋??ㄦ?ュ?g???规????变????借薄绫伙?瀹???璁镐娇?ㄦ?ュ?e??浣?涓哄??ㄥ??????绫诲??????甯哥???ㄦ????缂?灏???????寮??ㄥ??浠ヨ浆?㈠?版?ュ?g被????浠??ュ?g被??杞????instanceof 杩?绠?绗???浠ョ?ㄦ?ュ?冲????瀵硅薄??绫绘???????颁??ュ?c??
18??heap??stack??浠?涔??哄????
????涓?绉?绾垮舰????锛??舵坊???????ゅ??绱?????浣?搴??ㄥ??涓?娈靛???????????у??杩????虹???瑰?杩?琛?澶?????
????????涓?涓?缁?????绱?
19??forward ??redirect???哄??
forward?????″?ㄨ?锋?璧?婧?锛????″?ㄧ?存?ヨ?块???????板????URL锛????d釜URL????搴???瀹硅?诲??杩??ワ??跺????杩?浜???瀹瑰????缁?娴?瑙????娴?瑙??ㄦ?规??涓??ラ?????″?ㄥ????????瀹规??浠????挎?ョ??锛???浠ュ?????板????涓?杩??????ョ???板????
??? redirect灏辨?????$???规???昏?,????涓?涓??舵????,??璇?娴?瑙??ㄩ???板?昏?锋??d釜?板??锛?涓????ヨ?存?瑙??ㄤ??ㄥ????璇锋??????????伴???拌?锋?锛???浠?ession,request???伴?藉??浠ヨ?峰????
20??EJB涓?JAVA BEAN???哄??锛?
Java Bean ????澶??ㄧ??缁?浠讹?瀵?ava Bean骞舵病??涓ユ?肩??瑙???锛???璁轰?璁诧?浠讳?涓?涓?Java绫婚?藉??浠ユ??涓?涓?Bean??浣???甯告???典?锛??变?Java Bean??琚?瀹瑰?ㄦ????寤猴?濡?Tomcat锛???锛???浠?ava Bean搴??锋??涓?涓?????????????????锛???甯?ava Bean杩?瑕?瀹???erializable?ュ?g?ㄤ?瀹???ean????涔??с??Java Bean瀹???涓??稿?浜?寰?杞?COM妯″??涓??????拌?绋???COM缁?浠讹?瀹???涓??借?璺ㄨ?绋?璁块??????Enterprise Java Bean ?稿?浜?DCOM锛??冲??甯?寮?缁?浠躲??瀹????轰?Java??杩?绋??规?璋????RMI锛???????锛???浠?JB??浠ヨ?杩?绋?璁块??锛?璺ㄨ?绋???璺ㄨ?$???猴???浣?EJB蹇?椤昏?甯?缃插?ㄨ?稿?Webspere??WebLogic杩??风??瀹瑰?ㄤ腑锛?EJB瀹㈡?蜂?涓??存?ヨ?块????姝g??EJB缁?浠讹???????杩??跺?瑰?ㄨ?块????EJB瀹瑰?ㄦ??EJB缁?浠剁??浠g??锛?EJB缁?浠剁?卞?瑰?ㄦ????寤哄??绠$????瀹㈡?烽??杩?瀹瑰?ㄦ?ヨ?块????姝g??EJB缁?浠躲??
21??Static Nested Class ?? Inner Class??涓?????
??? Static Nested Class??琚?澹版??涓洪????锛?static锛??????ㄧ被锛?瀹???浠ヤ?渚?璧?浜?澶??ㄧ被瀹?渚?琚?瀹?渚?????????甯哥?????ㄧ被??瑕??ㄥ??ㄧ被瀹?渚????????藉??渚?????
22??JSP涓??ㄦ??INCLUDE涓?????INCLUDE???哄??锛?
?ㄦ??INCLUDE??sp:include?ㄤ?瀹???<jsp:include page="included.jsp" flush="true" />瀹??绘??浼?妫??ユ??????浠朵腑??????锛??????ㄤ??????ㄦ??椤甸???骞朵???浠ュ甫???般??
????INCLUDE??nclude浼???瀹???瀹?涓?浼?妫??ユ??????浠剁??????锛????ㄤ?????????椤甸??lt;%@ include file="included.htm" %>
23??浠?涔??跺????ssert??
??? assertion(??瑷?)?ㄨ蒋浠跺???涓???涓?绉?甯哥?ㄧ??璋?璇??瑰?锛?寰?澶?寮???璇?瑷?涓??芥????杩?绉??哄?躲???ㄥ???颁腑锛?assertion灏辨???ㄧ?搴?涓???涓??¤???ワ?瀹?瀵逛?涓?boolean琛ㄨ揪寮?杩?琛?妫??ワ?涓?涓?姝g‘绋?搴?蹇?椤讳?璇?杩?涓?boolean琛ㄨ揪寮????间负true锛?濡???璇ュ?间负false锛?璇存??绋?搴?宸茬?澶?浜?涓?姝g‘???舵??涓?锛?绯荤?灏?缁??鸿?????????恒??涓????ヨ?达?assertion?ㄤ?淇?璇?绋?搴????烘?????抽????姝g‘?с??assertion妫??ラ??甯稿?ㄥ?????娴?璇??跺?????涓轰???楂??ц?斤??ㄨ蒋浠跺??甯???锛?assertion妫??ラ??甯告???抽??????
24??GC??浠?涔?? 涓轰?涔?瑕???GC?
????GC?????炬?堕????????锛?Gabage Collection锛?,??瀛?澶?????缂?绋?浜哄??瀹规???虹?伴??棰????版?癸?蹇?璁版??????璇?????瀛????朵?瀵艰?寸?搴???绯荤???涓?绋冲?????冲穿婧?锛?Java??渚???GC???藉??浠ヨ???ㄧ??娴?瀵硅薄?????杩?浣??ㄥ??浠???杈惧?拌???ㄥ???跺??瀛???????锛?Java璇?瑷?娌℃????渚????惧凡??????瀛????剧ず??浣??规???
25??short s1 = 1; s1 = s1 + 1;??浠?涔???? short s1 = 1; s1 += 1;??浠?涔????
??? short s1 = 1; s1 = s1 + 1; 锛?s1+1杩?绠?缁?????int??锛???瑕?寮哄?惰浆?㈢被??锛?
short s1 = 1; s1 += 1;锛???浠ユ?g‘缂?璇?锛?
26??Math.round(11.5)绛??煎?灏?? Math.round(-11.5)绛??煎?灏??
??? Math.round(11.5)==12
Math.round(-11.5)==-11
round?规?杩???涓????版???ヨ????挎?存?帮????板??1/2??姹???loor.
27??String s = new String("xyz");??寤轰???涓?String Object?
??? 涓や釜
28??璁捐??涓?绾跨?锛??朵腑涓や釜绾跨?姣?娆″??澧???1锛????涓や釜绾跨?瀵?姣?娆″??灏?1?????虹?搴???
浠ヤ?绋?搴?浣跨?ㄥ???ㄧ被瀹??扮嚎绋?锛?瀵?澧??????跺??娌℃??????椤哄???棰???
public class ThreadTest1{
? private int j;
? public static void main(String args[]){
ThreadTest1 tt=new ThreadTest1();
Inc inc=tt.new Inc();
Dec dec=tt.new Dec();
for(int i=0;i<2;i++){
Thread t=new Thread(inc);
t.start();
t=new Thread(dec);
t.start();
}
}
? private synchronized void inc(){
j++;
System.out.println(Thread.currentThread().getName()+"-inc:"+j);
? }
? private synchronized void dec(){
j--;
System.out.println(Thread.currentThread().getName()+"-dec:"+j);
? }
? class Inc implements Runnable{
public void run(){
for(int i=0;i<100;i++){
inc();
}
}
? }
? class Dec implements Runnable{
public void run(){
for(int i=0;i<100;i++){
dec();
}
?}
? }
}
29??Java??娌℃??goto?
java涓???淇???瀛?锛??板?ㄦ病????ava涓?浣跨?ㄣ??
30?????ㄤ?涓?绾跨?????un()杩???start()?
???ㄤ?涓?绾跨???璋???tart()?规?锛?浣跨嚎绋???浠h〃??????澶????哄?浜???杩?琛??舵??锛?杩????崇??瀹???浠ョ??VM璋?搴?苟?ц???杩?骞朵????崇??绾跨?灏变?绔??宠?琛???run()?规???浠ヤ骇??蹇?椤婚???虹????蹇??ュ??姝??涓?绾跨???
31 ??EJB????锛?SessionBean,EntityBean锛?璇村?轰?浠??????藉?ㄦ??锛???濡?浣?绠$??浜??$??锛?
SessionBean锛?Stateless Session Bean ?????藉?ㄦ?????卞?瑰?ㄥ?冲????锛?褰?瀹㈡?锋?哄???鸿?锋?瑕?寤虹??涓?涓?Bean??瀹?渚??讹?EJB瀹瑰?ㄤ?涓?瀹?瑕???寤轰?涓??扮??Bean??瀹?渚?渚?瀹㈡?锋?鸿??????????渚挎?句?涓??版????瀹?渚???渚?缁?瀹㈡?锋?恒??褰?瀹㈡?锋?虹??涓?娆¤??ㄤ?涓?Stateful Session Bean ?讹?瀹瑰?ㄥ?椤荤???冲?ㄦ???″?ㄤ腑??寤轰?涓??扮??Bean瀹?渚?锛?骞跺?宠???板?㈡?锋?轰?锛?浠ュ??姝ゅ?㈡?锋?鸿???tateful Session Bean ???规??跺?瑰?ㄤ???璋??ㄥ??娲惧?颁?姝ゅ?㈡?锋?虹?稿?宠????Bean瀹?渚???
EntityBean锛?Entity Beans?藉??娲荤?稿?硅??跨???堕?达?骞朵??舵??????缁???????瑕??版??搴?涓????版??瀛????Entity beans灏变??村??娲汇????涓??????у??ㄧ?搴????????¤?绋??ヨ?寸?????充娇EJB瀹瑰?ㄥ穿婧?浜?锛?Entity beans涔???瀛?娲荤????Entity Beans???藉?ㄦ???藉?琚?瀹瑰?ㄦ???? Beans??宸辩?$????
EJB??杩?浠ヤ?????绠$??瀹??★?瀵硅薄绠$??缁?缁?锛?OMG锛???瀵硅薄瀹??℃???★?OTS锛?锛?Sun Microsystems??Transaction Service锛?JTS锛???Java Transaction API锛?JTA锛?锛?寮???缁?锛?X/Open锛???XA?ュ?c??
32??搴??ㄦ???″?ㄦ???d?锛?
BEA WebLogic Server锛?IBM WebSphere Application Server锛?Oracle9i Application Server锛?jBoss锛?Tomcat
33??缁???涓?涓?浣???甯歌??扮??runtime exception??
ArithmeticException, ArrayStoreException, BufferOverflowException, BufferUnderflowException, CannotRedoException, CannotUndoException, ClassCastException, CMMException, ConcurrentModificationException, DOMException, EmptyStackException, IllegalArgumentException, IllegalMonitorStateException, IllegalPathStateException, IllegalStateException, ImagingOpException, IndexOutOfBoundsException, MissingResourceException, NegativeArraySizeException, NoSuchElementException, NullPointerException, ProfileDataException, ProviderException, RasterFormatException, SecurityException, SystemException, UndeclaredThrowableException, UnmodifiableSetException, UnsupportedOperationException
34???ュ?f??????缁ф?挎?ュ?? ?借薄绫绘??????瀹???implements)?ュ?? ?借薄绫绘??????缁ф?垮??浣?绫?concrete class)?
?ュ?e??浠ョ户?挎?ュ?c???借薄绫诲??浠ュ????implements)?ュ?o??借薄绫绘??????缁ф?垮??浣?绫伙?浣???????瀹?浣?绫诲?椤绘????纭????????芥?般??
35??List, Set, Map????户?胯??Collection?ュ??
??? List锛?Set??锛?Map涓???
36??璇村?烘?版??杩??ユ???宸ヤ??哄?舵??浠?涔??
J2EE???″?ㄥ???ㄦ?朵?寤虹??涓?瀹??伴????姹?杩??ワ?骞朵??寸淮??涓?灏?浜?姝ゆ?扮????姹?杩??ャ??瀹㈡?风??绋?搴???瑕?杩??ユ?讹?姹?椹卞?ㄧ?搴?浼?杩???涓?涓???浣跨?ㄧ??姹?杩??ュ苟灏??惰〃璁颁负蹇???濡???褰???娌℃??绌洪?茶??ワ?姹?椹卞?ㄧ?搴?灏辨?板缓涓?瀹??伴????杩??ワ??板缓杩??ョ???伴??????缃????板?冲????褰?浣跨?ㄧ??姹?杩??ヨ??ㄥ??????锛?姹?椹卞?ㄧ?搴?灏?姝よ??ヨ〃璁颁负绌洪?诧??朵?璋??ㄥ氨??浠ヤ娇?ㄨ?涓?杩??ャ??
37??abstract??method?????????舵??static,?????????舵??native锛??????????舵??synchronized?
??? ?戒???38???扮???娌℃??length()杩?涓??规?? String??娌℃??length()杩?涓??规?锛?
?扮?娌℃??length()杩?涓??规?锛???length??灞??с??String????length()杩?涓??规???
39??Set??????绱???涓??介??澶???锛??d??ㄤ?涔??规??ュ?哄????澶?涓????? ????=杩???equals()? 瀹?浠???浣??哄???
Set??????绱???涓??介??澶???锛??d???terator()?规??ュ?哄????澶?涓?????equals()???よ?讳袱涓?Set?????哥????
??? equals()??==?规??冲??寮??ㄥ?兼??????????涓?瀵硅薄equals()?ㄧ被涓?琚?瑕???锛?涓虹????褰?涓や釜??绂荤??瀵硅薄????瀹瑰??绫诲???搁????璇?锛?杩??????笺??
40????????onstructor??????琚?override?
??????onstructor涓??借?缁ф?匡???姝や??介????Overriding锛?浣???浠ヨ???杞?verloading??
41????????浠ョ户??tring绫?
String绫绘??final绫绘??涓???浠ョ户?裤??
42??swtich?????戒??ㄥ??yte涓?锛??????戒??ㄥ??ong涓?锛??????戒??ㄥ??tring涓??
switch锛?expr1锛?涓?锛?expr1??涓?涓??存?拌〃杈惧?????姝や???缁? switch ?? case 璇??ョ?????板?璇ユ?? int?? short?? char ???? byte??long,string ?戒??戒??ㄤ?swtich??
43??try {}????涓?涓?return璇??ワ??d?绱ц??ㄨ?涓?try????finally {}????code浼?涓?浼?琚??ц?锛?浠?涔??跺??琚??ц?锛???eturn??杩??????
浼??ц?锛???eturn???ц???
44??缂?绋?棰?: ?ㄦ???????????规?绠???涔?浠?绛??煎???
2 << 3
45??涓や釜瀵硅薄?肩?稿??(x.equals(y) == true)锛?浣??村????涓?????hash code锛?杩??ヨ??瀵逛?瀵?
涓?瀵癸????稿????hash code??
46??褰?涓?涓?瀵硅薄琚?褰?浣????颁????颁?涓??规???锛?姝ゆ?规????瑰??杩?涓?瀵硅薄??灞??э?骞跺??杩???????????缁???锛??d?杩????板????间???杩???寮??ㄤ????
???间?????Java 缂?绋?璇?瑷??????间??????般??褰?涓?涓?瀵硅薄瀹?渚?浣?涓轰?涓????拌?浼????版?规?涓??讹????扮???煎氨??瀵硅?ュ?硅薄??寮??ㄣ??瀵硅薄????瀹瑰??浠ュ?ㄨ?璋??ㄧ???规?涓??瑰??锛?浣?瀵硅薄??寮??ㄦ??姘歌?涓?浼??瑰??????
47??褰?涓?涓?绾跨?杩??ヤ?涓?瀵硅薄??涓?涓?synchronized?规???锛??跺??绾跨???????杩??ユ?ゅ?硅薄???跺???规??
涓??斤?涓?涓?瀵硅薄??涓?涓?synchronized?规????界?变?涓?绾跨?璁块????
48??缂?绋?棰?: ??涓?涓?Singleton?烘?ャ??
Singleton妯″?涓昏?浣??ㄦ??淇?璇???ava搴??ㄧ?搴?涓?锛?涓?涓?绫?lass????涓?涓?瀹?渚?瀛??ㄣ??
涓???Singleton妯″???甯告????绉?绉?褰㈠?:
绗?涓?绉?褰㈠?: 瀹?涔?涓?涓?绫伙?瀹????????芥?颁负private??锛?瀹???涓?涓?static??private??璇ョ被????锛??ㄧ被??濮????跺??渚?璇?锛???杩?涓?涓?public??getInstance?规??峰??瀵瑰????寮???缁ц??璋??ㄥ?朵腑???规???
public class Singleton {
private Singleton(){}
??????? //?ㄨ??宸卞???ㄥ??涔???宸变?涓?瀹?渚?锛???涓???寰?濂???锛?
??????? //娉ㄦ??杩???private ??渚????ㄨ?????????? private static Singleton instance = new Singleton();
??????? //杩?????渚?浜?涓?涓?渚?澶??ㄨ?块????class???????规?锛???浠ョ?存?ヨ?块??????
??????? public static Singleton getInstance() {
??????????? return instance; ????
??????? }
??? }
??? 绗?浜?绉?褰㈠?:
public class Singleton {
????private static Singleton instance = null;
????public static synchronized Singleton getInstance() {
????//杩?涓??规?姣?涓??㈡?????硅?锛?涓??ㄦ??娆¢?借?琛?????瀵硅薄锛?????绗?涓?娆°?????? ??
????//浣跨?ㄦ?剁????瀹?渚?锛???楂?浜?????锛?
????if (instance==null)
????????instance锛?new Singleton();
return instance; ????}
}
?朵?褰㈠?:
瀹?涔?涓?涓?绫伙?瀹????????芥?颁负private??锛??????规?涓?tatic????
涓???璁や负绗?涓?绉?褰㈠?瑕??村??瀹??ㄤ?
49??Java???ュ?e??C++????绫荤???稿????涓???澶???
?变?Java涓?????澶?缁ф?匡????????芥??涓?绫绘??瀵硅薄瑕?浣跨?ㄥ?????ㄥ??涓?绫绘??瀵硅薄???㈢???规???灞??э??版??????缁ф?挎?哄?跺氨涓??芥弧瓒宠?姹???涓?缁ф?跨?告??锛??ュ?f???撮?????垫椿?э???涓烘?ュ?d腑娌℃??浠讳?瀹??颁唬????褰?涓?涓?绫诲???颁??ュ?d互??锛?璇ョ被瑕?瀹??版?ュ?i???㈡???????规???灞??э?骞朵??ュ?i???㈢??灞??у?ㄩ?璁ょ?舵??涓??㈤?芥??public static,?????规?榛?璁ゆ???典???public.涓?涓?绫诲??浠ュ???板?涓??ュ?c??
50??Java涓???寮?甯稿????哄?剁??绠?????????搴??ㄣ??
褰?JAVA绋?搴?杩???浜?JAVA??璇?涔?瑙????讹?JAVA?????哄氨浼?灏?????????璇?琛ㄧず涓轰?涓?寮?甯搞??杩???璇?涔?瑙???????2绉????点??涓?绉???JAVA绫诲???缃???璇?涔?妫??ャ??渚?濡??扮?涓???瓒???,浼?寮???IndexOutOfBoundsException;璁块??null??瀵硅薄?朵?寮???NullPointerException?????绉????靛氨??JAVA??璁哥?搴????╁?杩?绉?璇?涔?妫??ワ?绋?搴?????浠ュ??寤鸿??宸辩??寮?甯革?骞惰???遍???╁?ㄤ??剁??hrow?抽??瀛?寮???寮?甯搞????????寮?甯搁?芥??java.lang.Thowable??瀛?绫汇??
51?????惧???剁??浼??瑰????????骞惰????2绉????舵?哄?躲??
Java璇?瑷?涓?涓?涓??捐?????圭?瑰氨??寮??ヤ????惧???舵?哄?讹?浣?++绋?搴?????澶寸?肩????瀛?绠$??????棰?杩?????瑙o?瀹?浣垮?Java绋?搴????ㄧ???绋?搴????跺??涓?????瑕???????瀛?绠$?????变???涓????惧???舵?哄?讹?Java涓???瀵硅薄涓?????"浣??ㄥ??"??姒?蹇碉?????瀵硅薄??寮??ㄦ????"浣??ㄥ??"?????惧???跺??浠ユ???????叉?㈠??瀛?娉??诧???????浣跨?ㄥ??浠ヤ娇?ㄧ????瀛??????惧???跺?ㄩ??甯告??浣?涓轰?涓???????浣?绾у????绾跨?杩?琛?锛?涓???棰??ョ?????典?瀵瑰??瀛???涓?宸茬?姝讳骸???????挎?堕?存病??浣跨?ㄧ??瀵硅薄杩?琛?娓?妤??????讹?绋?搴???涓??藉???剁??璋??ㄥ???惧???跺?ㄥ?规??涓?瀵硅薄??????瀵硅薄杩?琛????惧???躲?????舵?哄?舵????浠e??跺???惧???跺????璁板???惧???讹?澧??????惧???躲??
52??璇疯?村?轰????ラ????绾跨???姝ョ???规???
wait():浣夸?涓?绾跨?澶?浜?绛?寰??舵??锛?骞朵????炬????????瀵硅薄??lock??
sleep():浣夸?涓?姝e?ㄨ?琛???绾跨?澶?浜??$???舵??锛???涓?涓??????规?锛?璋??ㄦ?ゆ?规?瑕?????InterruptedException寮?甯搞??
notify():?ら??涓?涓?澶?浜?绛?寰??舵????绾跨?锛?娉ㄦ???????ㄨ??ㄦ?ゆ?规????跺??锛?骞朵??界‘?????ら????涓?涓?绛?寰??舵????绾跨?锛???????VM纭?瀹??ら????涓?绾跨?锛???涓?涓?????浼???绾с??
Allnotity():?ら??????澶??ョ??寰??舵????绾跨?锛?娉ㄦ??骞朵???缁??????ら??绾跨?涓?涓?瀵硅薄????锛?????璁╁??浠?绔?浜???
53??浣????ラ????????绫婚?芥????浜?锛?涓昏??规?锛?
??甯哥?ㄧ??????绫绘?? List ?? Map?? List ???蜂?瀹??板???? ArrayList ?? Vector锛?瀹?浠???????澶у?????琛??姣?杈???????寤恒??瀛??ㄥ????浣?浠讳?绫诲??瀵硅薄????绱???琛ㄣ?? List ???ㄤ????板?肩储寮?璁块????绱?????褰???
Map ??渚?浜?涓?涓??撮???ㄧ????绱?瀛??ㄦ?规??? Map ????绫荤?ㄤ?瀛??ㄥ??绱?瀵癸?绉颁?"??"??"??锛?锛??朵腑姣?涓?????灏??颁?涓??笺??
54????杩颁?涓?JVM??杞?lass??浠剁???????哄??
JVM涓?绫荤??瑁?杞芥????lassLoader??瀹???瀛?绫绘?ュ???扮??,Java ClassLoader ??涓?涓???瑕???Java杩?琛??剁郴缁?缁?浠躲??瀹?璐?璐e?ㄨ?琛??舵?ユ?惧??瑁??ョ被??浠剁??绫汇??
55??char??????涓??戒??藉??璐?涓?涓?涓???姹?瀛??涓轰?涔??
?藉?瀹?涔???涓轰?涓?涓?????锛???涓?ava涓?浠?nicode缂???锛?涓?涓?char??16涓?瀛???锛???浠ユ?句?涓?涓?????娌¢??棰???
56??澶?绾跨?????绉?瀹??版?规?,?芥??浠?涔????姝ユ????绉?瀹??版?规?,?芥??浠?涔??
澶?绾跨???涓ょ?瀹??版?规?锛???????缁ф??hread绫讳?瀹???unnable?ュ??
??姝ョ??瀹??版?归?㈡??涓ょ?锛???????synchronized,wait涓?notify
57??JSP????缃?瀵硅薄???规???
request琛ㄧずHttpServletRequest瀵硅薄??瀹?????浜????虫?瑙??ㄨ?锋???淇℃??锛?骞朵???渚?浜???涓??ㄤ??峰??cookie, header, ??session?版???????ㄧ???规???
??? response琛ㄧずHttpServletResponse瀵硅薄锛?骞舵??渚?浜???涓??ㄤ?璁剧疆????娴?瑙??ㄧ????搴????规?锛?濡?cookies,澶翠俊??绛?锛?
??? out瀵硅薄??javax.jsp.JspWriter??涓?涓?瀹?渚?锛?骞舵??渚?浜???涓??规?浣夸??界?ㄤ???娴?瑙??ㄥ????杈??虹?????
??? pageContext琛ㄧず涓?涓?javax.servlet.jsp.PageContext瀵硅薄??瀹????ㄤ??逛究瀛?????绉????寸????瀛?绌洪?淬??servlet?稿?崇??瀵硅薄??API锛?骞朵???瑁?浜????ㄧ??servlet?稿?冲???界???规???
??? session琛ㄧず涓?涓?璇锋???javax.servlet.http.HttpSession瀵硅薄??Session??浠ュ??璐??ㄦ?风???舵??淇℃??
??? applicaton 琛ㄧず涓?涓?javax.servle.ServletContext瀵硅薄??杩????╀??ユ?炬????ervlet寮?????servlet??澧???淇℃??
??? config琛ㄧず涓?涓?javax.servlet.ServletConfig瀵硅薄??璇ュ?硅薄?ㄤ?瀛???servlet瀹?渚?????濮??????般??
??? page琛ㄧず浠?璇ラ〉??骇????涓?涓?servlet瀹?渚?
58??绾跨????烘??姒?蹇点??绾跨????烘???舵??浠ュ???舵??涔??寸???崇郴
绾跨????ㄧ?搴??ц?杩?绋?涓?锛??藉??ц?绋?搴?浠g????涓?涓??ц???浣?锛?姣?涓?绋?搴??冲??芥??涓?涓?绾跨?锛?涔?灏辨??绋?搴???韬???
Java涓???绾跨?????绉??舵????????锛?杩?琛???灏辩华????璧枫??缁?????
59??JSP??甯哥?ㄦ??浠?<%@page language="java" contenType="text/html;charset=gb2312" session="true" buffer="64kb" autoFlush="true" isThreadSafe="true" info="text" errorPage="error.jsp" isErrorPage="true" isELIgnored="true" pageEncoding="gb2312" import="java.sql.*"%>
isErrorPage(?????戒娇??xception瀵硅薄)锛?isELIgnored(????拷?ヨ〃杈惧?)
<%@include file="filename"%>
<%@taglib prefix="c"uri="http://......"%>
60??浠?涔????典?璋???oGet()??doPost()锛?
Jsp椤甸??腑??form??绛鹃????method灞??т负get?惰???oGet()锛?涓?ost?惰???oPost()??
61??servlet?????藉?ㄦ??
web瀹瑰?ㄥ??杞?ervlet锛????藉?ㄦ??寮?濮?????杩?璋???ervlet??init()?规?杩?琛?servlet????濮???????杩?璋???ervice()?规?瀹??帮??规??璇锋???涓???璋??ㄤ?????do***()?规???缁??????★?web瀹瑰?ㄨ???ervlet??destroy()?规???
62??濡?浣??板??servlet????绾跨?妯″?
<%@ page isThreadSafe="false"%>
63 ??椤甸?㈤?村?硅薄浼??????规?
request 锛?session锛?application锛?cookie绛?
64 ??JSP??Servlet????浜??稿???瑰??涓????癸?浠?浠?涔??寸????绯绘??浠?涔?锛?
JSP ??Servlet???????╁?锛???璐ㄤ???Servlet??绠????瑰?锛??村己璋?搴??ㄧ??澶?琛ㄨ〃杈俱??JSP缂?璇?????"绫?ervlet"??Servlet??JSP??涓昏???涓????瑰?ㄤ?锛?Servlet??搴??ㄩ?昏?????ava??浠朵腑锛?骞朵?瀹??ㄤ?琛ㄧず灞?涓???HTML????绂诲??ャ????JSP?????垫??Java??HTML??浠ョ?????涓?涓??╁???涓?jsp????浠躲??JSP渚ч??浜?瑙??撅?Servlet涓昏??ㄤ??у?堕?昏???
65 ????绉?浼?璇?璺?韪?????
浼?璇?浣??ㄥ??ServletsJSP 椤甸?㈡??杩?page????浠h〃涓?涓?涓?椤甸?㈢?稿?崇??瀵硅薄??灞??с??涓?涓?椤甸?㈢?变?涓?缂?璇?濂界?? Java servlet 绫伙???浠ュ甫??浠讳??? include ??浠わ?浣???娌℃?? include ?ㄤ?锛?琛ㄧず??杩??㈠???? servlet ??????琚?缂?璇??? servlet ?? JSP 椤甸??request????浠h〃涓? Web 瀹㈡?锋?哄???虹??涓?涓?璇锋??稿?崇??瀵硅薄??灞??с??涓?涓?璇锋????借法瓒?澶?涓?椤甸???娑???澶?涓? Web 缁?浠讹??变? forward ??浠ゅ?? include ?ㄤ????崇郴锛?
session????浠h〃涓??ㄤ???涓? Web 瀹㈡?锋?虹??涓?涓??ㄦ?蜂?楠??稿?崇??瀵硅薄??灞??с??涓?涓? Web 浼?璇???浠ヤ?缁?甯镐?璺ㄨ?澶?涓?瀹㈡?锋?鸿?锋?
application????浠h〃涓??翠釜 Web 搴??ㄧ?搴??稿?崇??瀵硅薄??灞??с??杩?瀹?璐ㄤ???璺ㄨ??翠釜 Web 搴??ㄧ?搴?锛?????澶?涓?椤甸????璇锋???浼?璇???涓?涓??ㄥ?浣??ㄥ??
66??Request瀵硅薄??涓昏??规?锛?
setAttribute(String name,Object)锛?璁剧疆??瀛?涓?ame??request?????板??getAttribute(String name)锛?杩?????ame??瀹???灞??у??getAttributeNames()锛?杩???request瀵硅薄????灞??х????瀛?????锛?缁?????涓?涓???涓剧??瀹?渚?
getCookies()锛?杩???瀹㈡?风????????Cookie瀵硅薄锛?缁?????涓?涓?Cookie?扮?
getCharacterEncoding()锛?杩???璇锋?涓???瀛?绗?????瑰?
getContentLength()锛?杩???璇锋???Body???垮害
getHeader(String name)锛??峰?HTTP??璁?瀹?涔?????浠跺ご淇℃??
getHeaders(String name)锛?杩?????瀹???瀛???request Header???????硷?缁?????涓?涓???涓剧??瀹?渚?
getHeaderNames()锛?杩?????浠?equest Header????瀛?锛?缁?????涓?涓???涓剧??瀹?渚?
getInputStream()锛?杩???璇锋???杈??ユ?锛??ㄤ??峰?璇锋?涓????版??
getMethod()锛??峰?瀹㈡?风???????″?ㄧ??浼????版?????规?
getParameter(String name)锛??峰?瀹㈡?风??浼???缁????″?ㄧ??????name??瀹??????板??getParameterNames()锛??峰?瀹㈡?风??浼???缁????″?ㄧ???????????扮????瀛?锛?缁?????涓?涓???涓剧??瀹?渚?
getParameterValues(String name)锛??峰???name??瀹??????扮????????getProtocol()锛??峰??瀹㈡?风???????″?ㄧ??浼????版????渚???????璁???绉?getQueryString()锛??峰??ヨ?㈠??绗?覆
getRequestURI()锛??峰?????鸿?锋?瀛?绗?覆??瀹㈡?风???板??
getRemoteAddr()锛??峰??瀹㈡?风????IP?板??
getRemoteHost()锛??峰??瀹㈡?风??????瀛?
getSession([Boolean create])锛?杩?????璇锋??稿??ession
getServerName()锛??峰?????″?ㄧ????瀛?
getServletPath()锛??峰??瀹㈡?风????璇锋?????????浠剁??璺?寰?
getServerPort()锛??峰?????″?ㄧ??绔??e??removeAttribute(String name)锛????よ?锋?涓???涓?涓?灞???67??J2EE??????杩???骞冲?拌???妗??讹?
??? J2EE??韬???涓?涓?????锛?涓?涓?涓轰?涓???甯?寮?搴??ㄧ??寮?????渚???????骞冲?般??
??? J2EE涔???涓?涓?妗??讹?????JDBC??JNDI??RMI??JMS??EJB??JTA绛???????
68????浠???eb搴??ㄥ???杩?绋?涓?缁?甯搁???拌??烘??绉?缂?????瀛?绗??濡?iso8859-1绛?锛?濡?浣?杈??轰?涓???绉?缂?????瀛?绗?覆锛?
? Public String translate (String str) {
??? String tempStr = "";
??? try {
????? tempStr = new String(str.getBytes("ISO-8859-1"), "GBK");
????? tempStr = tempStr.trim();
??? }
??? catch (Exception e) {
????? System.err.println(e.getMessage());
??? }
??? return tempStr;
? }
69??绠?杩伴?昏???浣?(&,|,^)涓??′欢??浣?(&&,||)???哄????
?哄??涓昏?绛?涓ょ?癸?a.?′欢??浣????芥??浣?甯?灏?????,???昏???浣?涓?浠???浠ユ??浣?甯?灏???,??涓???浠ユ??浣??板?煎??
b.?昏???浣?涓?浼?浜х????璺?
70??XML??妗e??涔?????绉?褰㈠?锛?瀹?浠?涔??存??浣???璐ㄥ?哄??锛?瑙f??XML??妗f??????绉??瑰?锛?
a: 涓ょ?褰㈠? dtd? schema锛?b: ??璐ㄥ?哄??:schema??韬???xml??锛???浠ヨ?XML瑙f???ㄨВ??(杩?涔???浠?DTD涓???灞?schema???规??????)锛?c:??DOM,SAX,STAX绛?
??? DOM:澶???澶у????浠舵?跺?舵?ц?戒???????甯稿??瀹炽??杩?涓???棰?????OM????缁???????????锛?杩?绉?缁??????ㄧ????瀛?杈?澶?锛???涓?DOM蹇?椤诲?ㄨВ????浠朵??????翠釜??妗h??ュ??瀛?,????瀵?ML?????鸿?块??
SAX:涓??颁?DOM,SAX??浜?浠堕┍?ㄥ????XML瑙f???瑰???瀹?椤哄?璇诲??XML??浠讹?涓???瑕?涓?娆″?ㄩ?ㄨ?杞芥?翠釜??浠躲??褰????板????浠跺?澶达???妗g???锛???????绛惧?澶翠???绛剧????讹?瀹?浼?瑙???涓?涓?浜?浠讹??ㄦ?烽??杩??ㄥ?跺??璋?浜?浠朵腑???ュ???浠g???ュ???XML??浠讹?????瀵?ML??椤哄?璁块??
??? STAX:Streaming API for XML (StAX)
71??绠?杩?ynchronized??java.util.concurrent.locks.Lock??寮???锛?
涓昏??稿???癸?Lock?藉????synchronized??瀹??扮??????????涓昏?涓????癸?Lock??姣?synchronized?寸簿纭???绾跨?璇?涔????村ソ???ц?姐??synchronized浼????ㄩ???鹃??锛???Lock涓?瀹?瑕?姹?绋?搴?????宸ラ???撅?骞朵?蹇?椤诲??inally浠??ヤ腑???俱??
72??EJB??瑙??插??涓?涓?瀵硅薄
涓?涓?瀹??寸???轰?EJB????甯?寮?璁$??缁????卞??涓?瑙??茬???锛?杩???涓?瑙??插??浠ョ?变?????寮???????渚?锛?姣?涓?瑙??叉??浣???宸ヤ?蹇?椤婚?靛惊Sun???告??渚???EJB瑙???锛?浠ヤ?璇?褰兼?や??寸???煎?规?с??杩???涓?瑙??插??????EJB缁?浠跺?????锛?Enterprise Bean Provider锛? ??搴??ㄧ?????锛?Application Assembler锛????ㄧ讲??锛?Deployer锛???EJB ???″?ㄦ??渚???锛?EJB Server Provider锛???EJB 瀹瑰?ㄦ??渚???锛?EJB Container Provider锛???绯荤?绠$????锛?System Administrator锛?
涓?涓?瀵硅薄??Remote锛?Local锛??ュ?c??Home锛?LocalHome锛??ュ?o?Bean绫?73??EJB瀹瑰?ㄦ??渚???????涓昏???渚?澹版???ㄦ??绠$????浠g??浜х??????缁??х?$????瀹??ㄣ??浜??$?$????????骞跺??琛?绠$??绛????°??
74??EJB瑙???瑙?瀹?EJB涓?绂?姝㈢????浣?????浜?锛?
??? 1.涓??芥??浣?绾跨???绾跨?API(绾跨?API????绾跨?瀵硅薄???规?濡?notify,wait绛?)锛?2.涓??芥??浣?awt锛?3.涓??藉???版???″?ㄥ???斤?4.涓??藉?归????灞???瀛???锛?5.涓??戒娇??O??浣??存?ュ??????浠剁郴缁?锛?6.涓??藉??杞芥???板?.锛?7.涓??藉?this浣?涓哄??????杩???锛?8.涓??藉惊??璋??ㄣ??
75??remote?ュ?e??home?ュ?d富瑕?浣???remote?ュ?e??涔?浜?涓??℃?规?锛??ㄤ?EJB瀹㈡?风??璋??ㄤ??℃?规???
home?ュ?f??EJB宸ュ???ㄤ???寤哄??绉婚?ゆ?ユ??JB瀹?渚?
76??bean 瀹?渚??????藉?ㄦ??
瀵逛?Stateless Session Bean??Entity Bean??Message Driven Bean涓???瀛??ㄧ??叉?绠$??锛???瀵逛?Entity Bean??Statefull Session Bean瀛???ache绠$??锛???甯稿??????寤哄??渚?锛?璁剧疆涓?涓???????寤?JB Object锛?create锛???涓??℃?规?璋??ㄣ??remove绛?杩?绋?锛?瀵逛?瀛??ㄧ??叉?绠$????Bean锛???reate涔???瀹?渚?骞朵?浠???瀛?娓??わ????????ㄧ??叉?璋?搴??哄?朵??????ㄥ??渚?锛???瀵逛?瀛???ache绠$????Bean????杩?婵?娲诲???绘?娲绘?哄?朵???Bean???舵??骞堕???跺??瀛?涓?瀹?渚??伴????
77??EJB??婵?娲绘?哄??浠?tateful Session Bean 涓轰?锛???ache澶у??冲??浜???瀛?涓???浠ュ???跺???ㄧ??Bean瀹?渚????伴??锛??规??MRU??NRU绠?娉?锛?瀹?渚??ㄦ?娲诲???绘?娲荤?舵??涔??磋?绉伙?婵?娲绘?哄?舵??褰?瀹㈡?风??璋??ㄦ??涓?EJB瀹?渚?涓??℃?规??讹?濡???瀵瑰?EJB Object???拌??宸辨病??缁?瀹?瀵瑰???Bean瀹?渚???浠??跺?绘?娲?ean瀛??ㄤ腑锛???杩?搴??????哄?跺???ㄥ??渚?锛???澶?锛?婵?娲伙?姝ゅ??渚????舵????杩???浼?璋??ㄥ?瑰???ejbActive??ejbPassivate?规???
78??EJB????绉?绫诲??
浼?璇?锛?Session锛?Bean 锛?瀹?浣?锛?Entity锛?Bean 娑???椹卞?ㄧ??锛?Message Driven锛?Bean
浼?璇?Bean??????涓烘???舵??锛?Stateful锛??????舵??锛?Stateless锛?涓ょ?
瀹?浣?Bean????涓?ean绠$??????缁??э?BMP锛???瀹瑰?ㄧ?$??????缁??э?CMP锛?涓ょ?
79??瀹㈡??绔?璋???JB瀵硅薄????涓??烘??姝ラ??璁剧疆JNDI???″伐??浠ュ??JNDI???″?板??绯荤?灞??э??ユ??ome?ュ?o?浠?Home?ュ?h???reate?规???寤?emote?ュ?o???杩?Remote?ュ?h??ㄥ?朵??℃?规???
80??濡?浣?缁?weblogic??瀹?澶у?????瀛??
?ㄥ????eblogic??????涓?锛?浣?浜?????omian瀵瑰????″?ㄧ??褰?涓???startServerName锛?锛?澧???set MEM_ARGS=-Xms32m -Xmx200m锛???浠ヨ??存??灏???瀛?涓?2M锛???澶?00M
81??濡?浣?璁惧????weblogic???????ㄦā寮?(寮???妯″?)涓?浜у????甯?妯″??
??浠ュ?ㄧ?$???у?跺?颁腑淇??瑰?瑰????″?ㄧ?????ㄦā寮?涓哄?????浜у??妯″?涔?涓???????淇??规???$?????ㄦ??浠舵????commenv??浠讹?澧???set PRODUCTION_MODE=true??
82??濡?浣????ㄦ?朵???杈??ョ?ㄦ?峰??涓?瀵????
淇??规???″???ㄦ??浠讹?澧??? WLS_USER??WLS_PW椤广??涔???浠ュ??oot.properties??浠朵腑澧?????瀵?杩????ㄦ?峰????瀵???.
83????eblogic绠$???跺?颁腑瀵逛?涓?搴??ㄥ??(????璇存??涓?涓?缃?绔?,Domain)杩?琛?jms??ejb??杩??ユ?绛??稿?充俊??杩?琛???缃???,瀹???淇?瀛??ㄤ?涔???浠朵腑?
淇?瀛??ㄦ??omain??config.xml??浠朵腑锛?瀹??????″?ㄧ???稿???缃???浠躲??
84??璇磋??eblogic涓?涓?涓?Domain??缂虹????褰?缁????姣?濡?瑕?灏?涓?涓?绠?????helloWorld.jsp?惧?ヤ???褰?涓?,?剁???ㄦ?瑙??ㄤ?灏卞??????ttp://涓绘??绔??e??/helloword.jsp灏卞??浠ョ???拌?琛?缁???浜?? ??姣?濡?杩??朵腑?ㄥ?颁?涓?涓???宸卞????javaBean璇ュ?浣????
Domain??褰?/???″?ㄧ??褰?/applications锛?灏?搴??ㄧ??褰??惧?ㄦ?ょ??褰?涓?灏???浠ヤ?涓哄??ㄨ?块??锛?濡?????Web搴????搴??ㄧ??褰???瑕?婊¤冻Web搴??ㄧ??褰?瑕?姹?锛?jsp??浠跺??浠ョ?存?ユ?惧?ㄥ??ㄧ??褰?涓?锛?Javabean??瑕??惧?ㄥ??ㄧ??褰???WEB-INF??褰???classes??褰?涓?锛?璁剧疆???″?ㄧ??缂虹??搴??ㄥ???浠ュ???板?ㄦ?瑙??ㄤ?????杈??ュ??ㄥ????
85????eblogic涓???甯?ejb??娑????板??浜???缃???浠?涓???绫诲????EJB娑???????缃???浠朵???锛??芥????扮????缃???浠跺????ejb-jar.xml,weblogic-ejb-jar.xmlCMP瀹?浣?Bean涓???杩???瑕?weblogic-cmp-rdbms-jar.xml
86??濡?浣???eblogic涓?杩?琛?ssl??缃?涓?瀹㈡?风????璁よ????缃???璇磋??2ee(????)杩?琛?ssl????缃?
缂虹??瀹?瑁?涓?浣跨??emoIdentity.jks??DemoTrust.jks? KeyStore瀹???SL锛???瑕???缃????″?ㄤ娇??nable SSL锛???缃??剁???o??ㄤ骇??妯″?涓???瑕?浠?CA?峰??绉???瀵??ュ???板??璇?涔????寤?dentity??trust keystore锛?瑁?杞借?峰???瀵??ュ???板??璇?涔?????浠ラ??缃?姝?SL杩??ユ??????杩???????????
87??濡?浣??ョ????eblogic涓?宸茬???甯???EJB?
??浠ヤ娇?ㄧ?$???у?跺?帮??ㄥ????Deployment涓???浠ユ?ョ??????宸插??甯???EJB
88??CORBA??浠?涔???ㄩ????浠?涔??
CORBA ?????????卞?硅薄璇锋?浠g??缁???(Common Object Request Broker Architecture)锛??卞?硅薄绠$??缁?缁? (Object Management Group锛?缂╁??涓?OMG)????????瀹???缁??????ュ?e??涔?璇?瑷?(IDL), 璇?瑷?缁?瀹?(binding:涔?璇?涓鸿??缂?)????璁稿??ㄧ?搴??翠???浣?????璁??? ?剁????涓猴??ㄤ?????绋?搴?璁捐?¤??瑷?涔????ㄤ?????杩?绋?涓?杩?琛?锛?涓轰???????浣?绯荤?寮?????
89??璇磋?翠???????????璇磋???j2ee涓?????绉?甯哥?ㄦā寮????瀵硅?捐?℃ā寮???涓?浜???娉?
? Session Facade Pattern锛?浣跨??essionBean璁块??EntityBean
Message Facade Pattern锛?瀹??板?姝ヨ???EJB Command Pattern锛?浣跨??ommand JavaBeans??浠?essionBean锛?瀹??拌交??绾ц?块??
Data Transfer Object Factory锛???杩?DTO Factory绠???EntityBean?版????渚??规??Generic Attribute Access锛???杩?AttibuteAccess?ュ?g????EntityBean?版????渚??规??Business Interface锛???杩?杩?绋?锛????帮??ュ?e??Bean绫诲???扮?稿???ュ?h???涓??¢?昏?涓??存??锛ワ吉锛㈡?舵????璁捐?″ソ??灏??存?ュ奖??绯荤????ц?姐?????╁??с????缁存?ゆ?с??缁?浠跺?????ㄦ?у??寮?????????椤圭??瓒?澶???锛?椤圭????浼?瓒?搴?澶у??瓒??戒??拌??濂借?捐?$????瑕??с??
90??璇磋?村??eblogic涓?寮???娑???Bean?剁??persistent涓?non-persisten??宸???
persistent?瑰???MDB??浠ヤ?璇?娑???浼???????????涔?灏辨??濡???EJB瀹瑰?ㄥ?虹?伴??棰???JMS???″?ㄤ??朵?灏?娑????ㄦ??DB???ㄧ???跺??????杩??ワ???non锛?persistent?瑰???娑???灏?琚?涓㈠???
91??Servlet?ц??朵???瀹??板????涓??规?锛?
public void init(ServletConfig config)
public ServletConfig getServletConfig()
public String getServletInfo()
public void service(ServletRequest request,ServletResponse response)
public void destroy()
92??j2ee甯哥?ㄧ??璁捐?℃ā寮?锛?璇存??宸ュ??妯″???
??? Java涓???23绉?璁捐?℃ā寮?锛?
Factory锛?宸ュ??妯″?锛?锛?????? Builder锛?寤洪??妯″?锛?锛??????? Factory Method锛?宸ュ???规?妯″?锛?锛?
Prototype锛???濮?妯″??妯″?锛?锛?Singleton锛???渚?妯″?锛?锛???? Facade锛??ㄩ?㈡ā寮?锛?锛?
Adapter锛??????ㄦā寮?锛?锛???? Bridge锛?妗ユ?妯″?锛?锛???????? Composite锛?????妯″?锛?锛?
Decorator锛?瑁?楗版ā寮?锛?锛???? Flyweight锛?浜???妯″?锛?锛????? Proxy锛?浠g??妯″?锛?锛?
Command锛??戒护妯″?锛?锛?????? Interpreter锛?瑙i???ㄦā寮?锛?锛? Visitor锛?璁块????妯″?锛?锛?
Iterator锛?杩?浠e??妯″?锛?锛??? Mediator锛?璋?????妯″?锛?锛???? Memento锛?澶?蹇?褰?妯″?锛?锛?
Observer锛?瑙?瀵???妯″?锛?锛??? State锛??舵??妯″?锛?锛????????? Strategy锛?绛??ユā寮?锛?锛?
Template Method锛?妯℃?挎?规?妯″?锛?锛? Chain Of Responsibleity锛?璐d换?炬ā寮?锛?
宸ュ??妯″?锛?宸ュ??妯″???涓?绉?缁?甯歌?浣跨?ㄥ?扮??妯″?锛??规??宸ュ??妯″?瀹??扮??绫诲??浠ユ?规????渚????版??????涓?缁?绫讳腑??涓?涓?绫荤??瀹?渚?锛???甯歌?涓?缁?绫绘??涓?涓????辩???借薄?剁被骞朵?瀹??颁??稿?????规?锛?浣???杩?浜??规???瀵逛??????版??杩?琛?浜?涓???????浣???棣?????瑕?瀹?涔?涓?涓??虹被锛?璇ョ被??瀛?绫婚??杩?涓??????规?瀹??颁??虹被涓????规????跺????瑕?瀹?涔?涓?涓?宸ュ??绫伙?宸ュ??绫诲??浠ユ?规???′欢????涓?????瀛?绫诲??渚???褰?寰??板??绫荤??瀹?渚???锛?寮???浜哄????浠ヨ??ㄥ?虹被涓????规???涓?蹇??????板?杩?????????涓?涓?瀛?绫荤??瀹?渚???
93??EJB???存?ュ???板????涓??℃?ュ?f??Home?ュ?e??锛?璇风??杩扮???便??
杩?绋??ュ?e??Home?ュ?d???瑕??存?ュ???帮?浠?浠???瀹??颁唬?????辨???″?ㄤ骇????锛?绋?搴?杩?琛?涓?瀵瑰?瀹??扮被浼?浣?涓哄?瑰??ュ?g被????瀹?渚?琚?浣跨?ㄣ??
94????搴??芥??????绉??规?锛?璇峰??涓俱????AVA瀹??颁?涓?蹇?????搴???
??? ??搴????规???锛????ユ??搴?锛??存?ユ???ユ??搴???甯?灏???搴?锛?锛?浜ゆ?㈡??搴?锛???娉℃??搴???蹇?????搴?锛?锛????╂??搴?锛??存?ラ???╂??搴???????搴?锛?锛?褰?骞舵??搴?锛???????搴?锛?绠辨??搴????烘?版??搴?锛?
蹇?????搴???浼?浠g????
/ /浣跨?ㄥ揩????搴??规?瀵?[ 0 :n- 1 ]??搴?
浠?a[ 0 :n- 1 ]涓????╀?涓???绱?浣?涓? i d d l e锛?璇ュ??绱?涓烘??????浣?涓?????绱????蹭负涓ゆ??eft ??r i g h t锛?浣垮?l e f t涓?????绱??藉?浜?绛?浜????癸???right 涓?????绱??藉ぇ浜?绛?浜???????褰??颁娇?ㄥ揩????搴??规?瀵?eft 杩?琛???搴?
??褰??颁娇?ㄥ揩????搴??规?瀵?ight 杩?琛???搴?
??寰?缁???涓? e f t + m i d d l e + r i g h t
95??璇峰?逛互涓???2EE涓?甯哥?ㄧ????璇?杩?琛?瑙i??(??绠?????杩?
web瀹瑰???缁?澶?浜??朵腑??搴??ㄧ?搴?缁?浠讹?JSP锛?SERVLET锛???渚?涓?涓???澧?锛?浣?SP,SERVLET?存?ユ?村?瑰?ㄤ腑????澧??????ュ?d氦浜?锛?涓?蹇??虫敞?跺??绯荤???棰???涓昏???WEB???″?ㄦ?ュ???般??渚?濡?锛?TOMCAT,WEBLOGIC,WEBSPHERE绛???璇ュ?瑰?ㄦ??渚????ュ?d弗?奸?靛??J2EE瑙???涓???WEB APPLICATION ????????浠????靛??浠ヤ???????WEB???″?ㄥ氨????J2EE涓???WEB瀹瑰?ㄣ??
EJB瀹瑰???Enterprise java bean 瀹瑰?ㄣ???村?锋??琛?涓?棰????硅?层??浠???渚?缁?杩?琛??ㄥ?朵腑??缁?浠?JB??绉?绠$?????姐????瑕?婊¤冻J2EE瑙?????EJB?惧?ヨ?ュ?瑰???椹?涓?灏变?琚?瀹瑰?ㄨ?琛?楂???????绠$????骞朵???浠ラ??杩??版?????ュ?f?ヨ?峰?绯荤?绾у???????°??渚?濡???浠舵???°??浜??$?$????
JNDI锛?锛?Java Naming & Directory Interface锛?JAVA?藉????褰????°??涓昏???渚??????芥??锛???渚?涓?涓???褰?绯荤?锛?璁╁?跺?????扮??搴??ㄧ?搴??ㄥ?朵??㈢??涓???宸辩??绱㈠?锛?浠???婊¤冻蹇????ユ?惧??瀹?浣???甯?寮?搴??ㄧ?搴??????姐??
JMS锛?锛?Java Message Service锛?JAVA娑??????°??涓昏?瀹??板??涓?搴??ㄧ?搴?涔??寸????璁????????瑰?圭?瑰??骞挎????
JTA锛?锛?Java Transaction API锛?JAVA浜??℃???°????渚???绉???甯?寮?浜??℃???°??搴??ㄧ?搴?????璋??ㄥ?舵??渚????ュ?e?冲????
JAF锛?锛?Java Action FrameWork锛?JAVA瀹??ㄨ?よ??妗??躲????渚?涓?浜?瀹??ㄦ?у?舵?归?㈢??妗??躲??璁╁???????杩???绉??ㄧ讲????瀹?涔?瀹??拌??宸辩??涓??у???ㄦ?у?剁???ャ??
RMI/IIOP:锛?Remote Method Invocation /internet瀵硅薄璇锋?涓?浠???璁?锛?浠?浠?涓昏??ㄤ???杩?杩?绋?璋??ㄦ???°??渚?濡?锛?杩?绋???涓??拌?$???轰?杩?琛?涓?涓?绋?搴?锛?瀹???渚??$エ???????★???浠???浠ュ?ㄦ???拌?$???轰?瀹??板?瑰?剁?存?ヨ??ㄣ??褰??惰???瑕???杩?涓?瀹???瑙??????藉?ㄥ?????绯荤?涔??磋?琛???淇°??RMI??JAVA?规??????
96??JAVA璇?瑷?濡?浣?杩?琛?寮?甯稿???锛??抽??瀛?锛?throws,throw,try,catch,finally????浠h〃浠?涔???涔?锛???ry??涓???浠ユ???哄?甯稿??锛?
Java??杩??㈠??瀵硅薄???规?杩?琛?寮?甯稿???锛?????绉?涓?????寮?甯歌?琛???绫伙?骞舵??渚?浜???濂界???ュ?c????ava涓?锛?姣?涓?寮?甯搁?芥??涓?涓?瀵硅薄锛?瀹???Throwable绫绘???跺??瀛?绫荤??瀹?渚???褰?涓?涓??规??虹?板?甯稿??渚挎???轰?涓?寮?甯稿?硅薄锛?璇ュ?硅薄涓???????寮?甯镐俊??锛?璋??ㄨ?涓?瀵硅薄???规???浠ユ???峰?拌?涓?寮?甯稿苟杩?琛?澶?????Java??寮?甯稿???????杩?5涓??抽??璇??ュ???扮??锛?try??catch??throw??throws??finally??涓??????典?????ry?ユ?ц?涓?娈电?搴?锛?濡????虹?板?甯革?绯荤?浼????猴?throws锛?涓?涓?寮?甯革?杩??跺??浣???浠ラ??杩?瀹???绫诲???ユ????锛?catch锛?瀹?锛???????锛?finally锛??辩己??澶????ㄦ?ュ?????
??ry?ユ??瀹?涓???棰??叉????"寮?甯???绋?搴???绱ц???ry绋?搴??????搴?????涓?涓?catch瀛??ユ?ユ??瀹?浣??宠???????"寮?甯???绫诲????
throw璇??ョ?ㄦ?ユ??纭??版???轰?涓?"寮?甯???
throws?ㄦ?ユ????涓?涓??????芥?板???芥???虹????绉?"寮?甯???
Finally涓虹‘淇?涓?娈典唬??涓?绠″????浠?涔?"寮?甯??借??ц?涓?娈典唬????
??浠ュ?ㄤ?涓??????芥?拌??ㄧ??澶??㈠??涓?涓?try璇??ワ??ㄨ?涓??????芥?板???ㄥ?????涓?try璇??ヤ??ゅ?朵?浠g????姣?褰????颁?涓?try璇??ワ?"寮?甯???妗??跺氨?惧?板????涓?????村?版??????try璇??ラ?藉??????濡???涓?涓?绾х??try璇??ユ病??瀵规??绉?"寮?甯?杩?琛?澶???锛?????灏变?灞?寮?锛??村?伴???版??澶???杩?绉?"寮?甯???try璇??ャ??
97??涓?涓?".java"婧???浠朵腑??????浠ュ????澶?涓?绫伙?涓??????ㄧ被锛?锛???浠?涔????讹?
??浠ャ??蹇?椤诲????涓?涓?绫诲??涓???浠跺???稿????
98??MVC????涓??ㄥ???芥???d??????ュ????濡?浣?瀹???
MVC??Model锛?View锛?Controller??绠?????"Model" 浠h〃????搴??ㄧ??涓??¢?昏?锛???杩?JavaBean锛?EJB缁?浠跺???帮?锛? "View" ??搴??ㄧ??琛ㄧず?????SP椤甸??骇??锛?锛?"Controller" ????渚?搴??ㄧ??澶???杩?绋??у?讹?涓?????涓?涓?Servlet锛?锛???杩?杩?绉?璁捐?℃ā????搴??ㄩ?昏?锛?澶???杩?绋????剧ず?昏?????涓?????缁?浠跺???般??杩?浜?缁?浠跺??浠ヨ?琛?浜や??????ㄣ??
99??java涓?????绉??规???浠ュ???颁?涓?绾跨?锛??ㄤ?涔??抽??瀛?淇?楗板??姝ユ?规?? stop()??suspend()?规?涓轰?涓??ㄨ??浣跨???
??涓ょ?瀹??版?规?锛???????缁ф??hread绫讳?瀹???unnable?ュ????ynchronized?抽??瀛?淇?楗板??姝ユ?规?
??瀵逛娇??top()锛?????涓哄??涓?瀹??ㄣ??瀹?浼?瑙i?ょ?辩嚎绋??峰??????????瀹?锛???涓?濡???瀵硅薄澶?浜?涓?绉?涓?杩?璐??舵??锛??d??朵?绾跨??藉?ㄩ?g??舵??涓?妫??ュ??淇??瑰??浠???缁???寰??炬??ュ?虹??姝g????棰????ㄣ??suspend()?规?瀹规??????姝婚????璋???uspend()???跺??锛?????绾跨?浼???涓??ワ?浣??翠??舵?????ㄨ?涔????峰?????瀹???姝ゆ?讹??朵?浠讳?绾跨??戒??借?块????瀹???璧?婧?锛??ら??琚?"??璧???绾跨??㈠?杩?琛???瀵逛换浣?绾跨??ヨ?达?濡???瀹?浠??虫?㈠?????绾跨?锛????跺??璇??句娇?ㄤ换浣?涓?涓???瀹???璧?婧?锛?灏变?????姝婚??????浠ヤ?搴?璇ヤ娇??uspend()锛???搴??ㄨ??宸辩??Thread绫讳腑缃??ヤ?涓???蹇?锛????虹嚎绋?搴?璇ユ椿?ㄨ?????璧枫???ユ??蹇????虹嚎绋?搴?璇ユ??璧凤?渚跨??ait()?藉?惰??ョ??寰??舵?????ユ??蹇????虹嚎绋?搴?褰??㈠?锛????ㄤ?涓?notify()???板???ㄧ嚎绋???
100??java涓?????绉?绫诲????娴?锛?JDK涓烘??绉?绫诲????娴???渚?浜?涓?浜??借薄绫讳互渚?缁ф?匡?璇疯?村?轰?浠?????????浜?绫伙?
瀛???娴?锛?瀛?绗????瀛???娴?缁ф?夸?InputStream / OutputStream锛?瀛?绗??缁ф?夸?InputStreamReader / OutputStreamWriter????ava.io??涓?杩???璁稿??朵???娴?锛?涓昏???涓轰???楂??ц?藉??浣跨?ㄦ?逛究??
101??java涓?浼?瀛??ㄥ??瀛?娉?婕???锛?璇风??????杩般??
浼???濡?锛?int i,i2;? return (i-i2);?? //when i涓鸿冻澶?澶х??姝f??i2涓鸿冻澶?澶х??璐??般??缁???浼?????婧??锛?瀵艰?撮??璇???
102??java涓?瀹??板??????哄?舵??浠?涔?锛?
?规???????Overriding????杞?verloading??Java澶????х??涓???琛ㄧ?般??????Overriding???剁被涓?瀛?绫讳??村????х??涓?绉?琛ㄧ?帮???杞?verloading??涓?涓?绫讳腑澶????х??涓?绉?琛ㄧ?般??
103?????惧???跺?ㄧ???烘????????浠?涔?锛????惧???跺?ㄥ??浠ラ┈涓????跺??瀛???锛???浠?涔???娉?涓诲?ㄩ???ヨ?????鸿?琛????惧???讹?
瀵逛?GC?ヨ?达?褰?绋?搴?????寤哄?硅薄?讹?GC灏卞?濮????ц?涓?瀵硅薄???板????澶у?浠ュ??浣跨?ㄦ???点????甯革?GC???ㄦ?????剧???瑰?璁板???绠$????(heap)涓???????瀵硅薄????杩?杩?绉??瑰?纭?瀹???浜?瀵硅薄??"??杈剧??"锛???浜?瀵硅薄??"涓???杈剧??"??褰?GC纭?瀹?涓?浜?瀵硅薄涓?涓???杈??讹?GC灏辨??璐d换???惰?浜???瀛?绌洪?淬????浠ャ??绋?搴?????浠ユ???ㄦ?ц?System.gc()锛?????C杩?琛?锛?浣???Java璇?瑷?瑙???骞朵?淇?璇?GC涓?瀹?浼??ц???
104????????????瀹?渚????????哄??锛?
static i = 10; //甯搁??
?? class A a;? a.i =10;//????
105??浠?涔???java搴?????锛?濡?浣?瀹???ava搴?????锛?
搴?????灏辨??涓?绉??ㄦ?ュ???瀵硅薄娴????哄?讹???璋?瀵硅薄娴?涔?灏辨??灏?瀵硅薄????瀹硅?琛?娴???????浠ュ?规???????瀵硅薄杩?琛?璇诲????浣?锛?涔???灏?娴???????瀵硅薄浼?杈?浜?缃?缁?涔??淬??搴???????涓轰?瑙e?冲?ㄥ?瑰?硅薄娴?杩?琛?璇诲????浣??舵??寮???????棰???
搴???????瀹??帮?灏???瑕?琚?搴???????绫诲????erializable?ュ?o?璇ユ?ュ?f病????瑕?瀹??扮???规?锛?implements Serializable????涓轰???娉ㄨ?ュ?硅薄????琚?搴???????锛??跺??浣跨?ㄤ?涓?杈??烘?(濡?锛?FileOutputStream)?ユ????涓?涓?ObjectOutputStream(瀵硅薄娴?)瀵硅薄锛??ョ??锛?浣跨??bjectOutputStream瀵硅薄??writeObject(Object obj)?规?灏卞??浠ュ????颁负obj??瀵硅薄?????充?瀛??剁?舵??)锛?瑕??㈠???璇????ㄨ??ユ???
106????????浠ヤ?涓?涓?static?规????ㄥ???哄?归??static?规???璋????
涓???浠?濡????朵腑????瀵硅薄??method()锛?涓??戒?璇?瀵硅薄??濮???.
107????clone()?规??讹???甯搁?芥??涓?琛?浠g??锛???浠?涔?锛?
Clone ??缂虹??琛?涓猴?super.clone();浠?璐?璐d骇??姝g‘澶у???绌洪?达?骞堕??浣?澶??躲??
108????AVA涓?锛?濡?浣?璺冲?哄?????澶???宓?濂?寰???锛?
??reak; return ?规???
109??List??Map??Set涓?涓??ュ?o?瀛?????绱??讹?????浠?涔??圭?癸?
List 浠ョ?瑰??娆″??ユ??????绱?锛???????澶???绱???Set ??娉??ユ????澶???绱?,???ㄦ??搴???Map 淇?瀛?key-value?硷?value??澶??笺??
110??J2EE??浠?涔?锛?
J2EE??Sun???告???虹??澶?灞?(multi-diered),??甯?寮?(distributed),?轰?缁?浠?component-base)??浼?涓?绾у??ㄦā??(enterpriese application model).?ㄨ??风??涓?涓?搴??ㄧ郴缁?涓?锛??????у???藉????涓轰?????缁?浠讹?杩?浜?缁?浠跺?????ㄤ???璁$???轰?锛?骞朵?澶?浜??稿???灞?娆?tier)涓?????灞?灞?娆″????瀹㈡?峰?(clietn tier)缁?浠?web灞???缁?浠?Business灞???缁?浠?浼?涓?淇℃??绯荤?(EIS)灞???
111??UML?归??
????寤烘ā璇?瑷?UML???ㄤ?????????????绫诲?俱??瀵硅薄?惧??????,琛?涓哄??浜や???椤哄?????浣???,瀹??板?俱??
112??璇村?轰?浜?甯哥?ㄧ??绫伙???锛??ュ?o?璇峰??涓?涓?
甯哥?ㄧ??绫伙?BufferedReader? BufferedWriter? FileReader? FileWirter? String? Integer
甯哥?ㄧ????锛?java.lang? java.awt? java.io? java.util? java.sql
甯哥?ㄧ???ュ?o?Remote? List? Map? Document? NodeList
113??寮???涓??界?ㄥ?颁??d?璁捐?℃ā寮???ㄥ?ㄤ?涔??哄???
姣?涓?妯″??芥??杩颁?涓?涓??ㄦ??浠?????澧?涓?涓????虹?扮????棰?锛??跺????杩颁?璇ラ??棰???瑙e?虫?规????稿?????杩?杩?绉??瑰?锛?浣???浠ユ???版?″?颁娇?ㄩ?d?宸叉????瑙e?虫?规?锛??????ㄩ??澶??稿????宸ヤ???涓昏??ㄥ?颁?MVC??璁捐?℃ā寮????ㄦ?ュ???JSP/Servlet????J2EE???稿?冲??ㄣ??绠???宸ュ??妯″?绛???
114??jsp????浜??ㄤ??浣??ㄥ??????浠?涔??
JSP?辨??浠ヤ?6绉??烘???ㄤ? jsp:include锛??ㄩ〉?㈣?璇锋????跺??寮??ヤ?涓???浠躲?? jsp:useBean锛?瀵绘?炬????瀹?渚???涓?涓?JavaBean?? jsp:setProperty锛?璁剧疆JavaBean??灞??с?? jsp:getProperty锛?杈??烘??涓?JavaBean??灞??с?? jsp:forward锛???璇锋?杞??颁?涓??扮??椤甸???? jsp:plugin锛??规??娴?瑙??ㄧ被??涓?ava??浠剁????OBJECT??EMBED??璁般??
115??Anonymous Inner Class (?垮?????ㄧ被) ??????浠?xtends(缁ф???跺??绫伙???????浠?mplements(瀹???interface(?ュ???
??浠ョ户?垮?朵?绫绘??瀹????朵??ュ?o???wing缂?绋?涓?甯哥?ㄦ?ゆ?瑰???
116??搴??ㄦ???″?ㄤ?WEB SERVER???哄??锛?
搴??ㄦ???″???Weblogic??Tomcat??Jboss
WEB SERVER锛?IIS?? Apache
117??BS涓?CS????绯讳??哄????
C/S??Client/Server??缂╁???????″?ㄩ??甯搁???ㄩ???ц?界??PC??宸ヤ?绔???灏????猴?骞堕???ㄥぇ???版??搴?绯荤?锛?濡?Oracle??Sybase??Informix?? SQL Server??瀹㈡?风????瑕?瀹?瑁?涓??ㄧ??瀹㈡?风??杞?浠躲??
B/锛虫??Brower/Server??缂╁??锛?瀹㈡?锋?轰???瑕?瀹?瑁?涓?涓?娴?瑙????Browser锛?锛?濡?Netscape Navigator??Internet Explorer锛????″?ㄥ??瑁?Oracle??Sybase??Informix?? SQL Server绛??版??搴????ㄨ?绉?缁???涓?锛??ㄦ?风???㈠???ㄩ??杩?WWW娴?瑙??ㄥ???帮?涓??ㄥ??浜??¢?昏??ㄥ??绔?瀹??帮?浣???涓昏?浜??¢?昏??ㄦ???″?ㄧ??瀹??般??娴?瑙??ㄩ??杩?锛?b Server ???版??搴?杩?琛??版??浜や???
C/S 涓? B/S ?哄??锛?
锛?锛?纭?浠剁??澧?涓???:
????C/S 涓???寤虹???ㄤ??ㄧ??缃?缁?涓?, 灏????撮????缃?缁???澧?, 灞???缃?涔??村????杩?涓??ㄦ???″?ㄦ??渚?杩??ュ???版??浜ゆ?㈡????
????B/S 寤虹???ㄥ箍??缃?涔?涓???, 涓?蹇???涓??ㄧ??缃?缁?纭?浠剁??澧?,渚?涓??佃??涓?缃?, 绉??ㄨ?惧?. 淇℃????宸辩?$??. ??姣?C/S?村己????搴????? 涓?????瑕?????浣?绯荤???娴?瑙??ㄥ氨琛?
锛?锛?瀵瑰???ㄨ?姹?涓???
????C/S 涓????㈠???稿?瑰?哄?????ㄦ?风兢, 瀵逛俊??瀹??ㄧ???у?惰?藉??寰?寮? 涓???楂?搴??哄????淇℃??绯荤?????/S 缁?????瀹?. ??浠ラ??杩?B/S??甯??ㄥ??????寮?淇℃??.
????B/S 寤虹???ㄥ箍??缃?涔?涓?, 瀵瑰???ㄧ???у?惰?藉???稿?瑰急, ???介?㈠??涓????ョ???ㄦ?枫??
锛?锛?瀵圭?搴??舵??涓???
????C/S 绋?搴???浠ユ?村??娉ㄩ??娴?绋?, ??浠ュ?规????澶?灞?娆℃?¢??, 瀵圭郴缁?杩?琛???搴???浠ヨ?灏?????.
????B/S 瀵瑰???ㄤ互??璁块????搴???澶?????????, 寤虹???ㄩ??瑕??村??浼??????虹?涔?涓?. 姣?C/S???撮????瑕?姹? B/S缁?????绋?搴??舵??????灞???瓒??? 浠?MS??.Net绯诲????BizTalk 2000 Exchange 2000绛?, ?ㄩ?㈡????缃?缁?????浠舵??寤虹??绯荤?. SUN ??IBM?ㄧ??JavaBean ??浠舵????绛?,浣?B/S?村??????.
锛?锛?杞?浠堕???ㄤ???
????C/S 绋?搴???浠ヤ????垮?????翠??ц????, ??浠剁?????ㄦ?т?濡???/S瑕?姹?涓?????浠剁?????ㄦ?уソ.
????B/S 瀵圭??澶???缁???,瑕?姹???浠剁?稿?圭??绔??????? ?藉??稿?硅?濂界??????灏卞?ヤ拱?ョ??椁?妗???浠ュ???╃????涓??????ㄥ?涓????冲ご妗?瀛?
锛?锛?绯荤?缁存?や????
????C/S 绋?搴??变??翠??? 蹇?椤绘?翠???瀵?, 澶????虹?扮????棰?浠ュ??绯荤???绾? ??绾ч?? ???芥??????涓?涓??ㄦ?扮??绯荤?
????B/S ??浠剁???,?归?㈡??浠朵釜?????存??瀹??扮郴缁?????缂???绾? 绯荤?缁存?ゅ??????版??灏?.?ㄦ?蜂?缃?涓???宸变?杞藉??瑁?灏卞??浠ュ???板??绾?
锛?锛?澶?????棰?涓???
????C/S 绋?搴???浠ュ????ㄦ?烽?㈠?哄??, 骞朵??ㄧ?稿???哄??, 瀹??ㄨ?姹?楂???姹?, 涓???浣?绯荤??稿?? 搴?璇ラ?芥???稿????绯荤?
????B/S 寤虹???ㄥ箍??缃?涓?, ?㈠??涓??????ㄦ?风兢, ???e?板??, 杩???C/S??娉?浣??扮??. 涓???浣?绯荤?骞冲?板?崇郴??灏?.
锛?锛??ㄦ?锋?ュ?d???
????C/S 澶???寤虹????Window骞冲?颁?,琛ㄧ?版?规?????,瀵圭?搴???????瑕?姹?杈?楂?
????B/S 寤虹???ㄦ?瑙??ㄤ?, ???村??涓板???????ㄧ??琛ㄧ?版?瑰?涓??ㄦ?蜂氦娴?. 骞朵?澶ч?ㄥ???惧害??浣?,??浣?寮???????.
锛?锛?淇℃??娴?涓???
????C/S 绋?搴?涓??????稿????涓?澶????????烘?寮?澶???, 浜や??х?稿?逛?
????B/S 淇℃??娴?????????, B-B B-C B-G绛?淇℃????娴?????????, ?村??浜ゆ??涓?蹇???
118??LINUX涓?绾跨?锛?GDI绫荤??瑙i????
LINUX瀹??扮??灏辨???轰??稿?杞婚??绾ц?绋???"涓?瀵逛?"绾跨?妯″??锛?涓?涓?绾跨?瀹?浣?瀵瑰?涓?涓??稿?杞婚??绾ц?绋?锛???绾跨?涔??寸??绠$???ㄦ?稿??芥?板?涓?瀹??般??
GDI绫讳负?惧??璁惧?缂?绋??ュ?g被搴???
119??STRUTS??搴???濡?STRUTS?舵??)
Struts??????ava Servlet/JavaServer Pages????锛?寮???Web搴??ㄧ?搴???寮??炬?????framework?? ????truts?藉????哄?轰?MVC(Model-View-Controller)璁捐?℃ā寮???搴??ㄦ???躲?? Struts??濡?涓???涓昏????斤? 涓?.????涓?涓?controller servlet锛??藉??ㄦ?风??璇锋??????扮?稿???Action瀵硅薄??浜?.JSP????ag搴?锛?骞朵???ontroller servlet涓???渚??宠??????锛?甯??╁???????寤轰氦浜?寮?琛ㄥ??搴??ㄣ?? 涓?.??渚?浜?涓?绯诲??瀹??ㄥ?硅薄锛?XML澶???????杩?Java reflection APIs???ㄥ???JavaBeans灞??с???介????????绀哄??娑?????
120??Jdo??浠?涔??
JDO??Java瀵硅薄??涔??????扮??瑙???锛?涓?ava data object??绠?绉?涔???涓?涓??ㄤ?瀛?????绉??版??浠?搴?涓???瀵硅薄????????API??JDO??渚?浜???????瀵硅薄瀛??????姝ゅ?瑰???浜哄???ヨ?达?瀛??ㄦ?版??瀵硅薄瀹??ㄤ???瑕?棰?澶???浠g??锛?濡?JDBC API??浣跨?????杩?浜?绻?????渚?琛?宸ヤ?宸茬?杞?绉诲??DO浜у????渚???韬?涓?锛?浣垮???浜哄??瑙h?卞?烘?ワ?浠?????涓??堕?村??绮惧???ㄤ??¢?昏?涓??????锛?JDO寰??垫椿锛???涓哄????浠ュ?ㄤ换浣??版??搴?灞?涓?杩?琛???JDBC?????㈠???崇郴?版??搴?锛?RDBMS锛?JDO?撮???????渚??颁换浣??版??搴?灞???瀛??ㄥ???斤?姣?濡??崇郴?版??搴?????浠躲??XML浠ュ??瀵硅薄?版??搴?锛?ODBMS锛?绛?绛?锛?浣垮?搴??ㄥ??绉绘??ф?村己??
121?????ㄧ被??浠ュ??ㄤ?????绫荤????????锛???娌℃??浠?涔????讹?
涓?涓????ㄧ被瀵硅薄??浠ヨ?块????寤哄????澶??ㄧ被瀵硅薄????瀹?122??WEB SERVICE??璇?瑙i????JSWDL寮???????浠?缁???JAXP??JAXM??瑙i????SOAP??UDDI,WSDL瑙i????
Web ServiceWeb Service???轰?缃?缁???????甯?寮???妯″????缁?浠讹?瀹??ц??瑰????浠诲?★??靛???蜂???????瑙???锛?杩?浜?瑙???浣垮?Web Service?戒??朵??煎?圭??缁?浠惰?琛?浜???浣???
JAXP(Java API for XML Parsing) 瀹?涔?浜???ava涓?浣跨??OM, SAX, XSLT?????ㄧ???ュ?c??杩??峰?ㄤ???绋?搴?涓?浣???瑕?浣跨?ㄨ?浜????ㄧ???ュ?o?褰?浣???瑕??瑰???蜂???瀹??版?跺??涔?涓???瑕?淇??逛唬????
JAXM(Java API for XML Messaging) ??涓?OAP??淇℃??渚?璁块???规???浼?杈??哄?剁??API??
WSDL??涓?绉? XML ?煎?锛??ㄤ?灏?缃?缁????℃??杩颁负涓?缁?绔??癸?杩?浜?绔??瑰?瑰?????㈠????妗d俊?????㈠??杩?绋?淇℃????娑???杩?琛???浣???杩?绉??煎?棣???瀵规??浣???娑???杩?琛??借薄??杩帮??跺??灏??剁?瀹??板?蜂???缃?缁???璁???娑????煎?涓?浠ュ??涔?绔??广???稿?崇???蜂?绔??瑰?崇?????涓烘?借薄绔??癸????★???
SOAP?崇????瀵硅薄璁块????璁?(Simple Object Access Protocol)锛?瀹????ㄤ?浜ゆ??ML缂???淇℃????杞婚??绾у??璁???
UDDI ????????涓虹?靛?????″缓绔?????锛?UDDI??涓?濂??轰?Web??????甯?寮?????涓?eb Service??渚?????淇℃??娉ㄥ??涓?蹇???瀹??版????瑙???锛????朵?????涓?缁?浣夸?涓??藉???韬???渚???Web Service娉ㄥ??锛?浠ヤ娇????浼?涓??藉????扮??璁块????璁???瀹??版??????
JAVA 浠g???ラ??
1.
abstract class Name {
?? private String name;
?? public abstract boolean isStupidName(String name) {}
}
澶т?浠?锛?杩???浣???璇??
绛?妗?: ????abstract method蹇?椤讳互???风?灏撅?涓?涓?甯??辨???枫??
2.
public class Something {
?? void doSomething () {
?????? private String s = "";
?????? int l = s.length();
?? }
}
???????
绛?妗?: ????灞??ㄥ??????涓??芥?剧疆浠讳?璁块??淇?楗扮??(private锛?public锛???protected)??final??浠ョ?ㄦ?ヤ慨楗板??ㄥ????
(final濡???abstract??strictfp锛??芥????璁块??淇?楗扮???strictfp???戒慨楗?lass??method????variable)??
3.
abstract class Something {
?? private abstract String doSomething ();
}
杩?濂藉??娌′?涔?????
绛?妗?: ????abstract??methods涓??戒互private淇?楗般??abstract??methods灏辨??璁╁??绫?mplement(瀹????蜂?缁?????锛???涔???浠ョ??rivate??abstract
method灏???璧锋?ュ?? (????锛?abstract method??涓??藉??final)??
4.
public class Something {
?? public int addOne(final int x) {
?????? return ++x;
?? }
}
杩?涓?姣?杈????俱??
绛?妗?: ????int x琚?淇?楗版??final锛????崇??x涓??藉??ddOne method涓?琚?淇??广??
5.
public class Something {
?? public static void main(String[] args) {
?????? Other o = new Other();
?????? new Something().addOne(o);
?? }
?? public void addOne(final Other o) {
?????? o.i++;
?? }
}
class Other {
?? public int i;
}
??涓??㈢??寰??镐技锛??芥???充?final????棰?锛?杩????????
绛?妗?: 姝g‘????ddOne method涓?锛?????琚?淇?楗版??final??濡?????ddOne method????浠?淇??逛?o??reference
(姣?濡?: o = new Other();)锛??d?濡???涓?渚?杩?棰?涔?????????浣?杩???淇??圭????o??member vairable
(????????)锛???o??reference骞舵病???瑰????
6.
class Something {
??? int i;
??? public void doSomething() {
??????? System.out.println("i = " + i);
??? }
}
??浠?涔????? ??涓??烘?ュ????
绛?妗?: 姝g‘??杈??虹????"i = 0"??int i灞???nstant variable (瀹?渚?????锛?????????????)??instant variable??default value??int??default value??0??
7.
class Something {
??? final int i;
??? public void doSomething() {
??????? System.out.println("i = " + i);
??? }
}
??涓????棰?????涓?涓??版?逛???锛?灏辨??澶?浜?涓?涓?final??杩??鹃??灏遍??浜????
绛?妗?: ????final int i??涓?final??instant variable (瀹?渚?????锛?????????????)??final??instant variable娌℃??default value锛?蹇?椤诲??onstructor (??????缁???涔???琚?璧?浜?涓?涓???纭????笺????浠ヤ慨?逛负"final int i = 0;"??
8.
public class Something {
???? public static void main(String[] args) {
??????? Something s = new Something();
??????? System.out.println("s.doSomething() returns " + doSomething());
??? }
??? public String doSomething() {
??????? return "Do something ...";
??? }
}
???涓??诲?瀹?缇???
绛?妗?: ??????涓??诲??ain??call doSomething娌℃??浠?涔???棰?锛?姣?绔?涓や釜methods?藉?ㄥ??涓?涓?class????浣?浠?缁???锛?main??static????static method涓??界?存??all non-static methods?????规??"System.out.println("s.doSomething() returns " + s.doSomething());"??????锛?static method涓??借?块??non-static instant variable??
9.
姝ゅ?锛?Something绫荤????浠跺????OtherThing.java
class Something {
??? private static void main(String[] something_to_do) {???????
??????? System.out.println("Do something ...");
??? }
}
?杩?涓?濂藉??寰????俱??
绛?妗?: 姝g‘??浠??ユ病??浜鸿?磋?Java??Class??瀛?蹇?椤诲???舵??浠跺???稿????浣?public class????瀛?蹇?椤诲????浠跺???稿????
10锛?
interface? A{
?? int x = 0;
}
class B{
?? int x =1;
}
class C extends B implements A {
?? public void pX(){
????? System.out.println(x);
?? }
?? public static void main(String[] args) {
????? new C().pX();
?? }
}
绛?妗?锛???璇????ㄧ?璇??朵???????璇?(??璇???杩颁?????JVM??涓?????淇℃??锛?????灏辨??????纭???x璋????涓や釜x?藉?归??锛?灏辫薄?ㄥ????mport java.util??java.sql涓や釜???剁?存?ュ0??Date涓??凤???瀵逛??剁被??????,??浠ョ??uper.x?ユ??纭?锛????ュ?g??灞??ч?璁ら????涓?public static final.??浠ュ??浠ラ??杩?A.x?ユ??纭???
11.
interface Playable {
??? void play();
}
interface Bounceable {
??? void play();
}
interface Rollable extends Playable, Bounceable {
??? Ball ball = new Ball("PingPang");
}
class Ball implements Rollable {
??? private String name;
??? public String getName() {
??????? return name;
??? }
??? public Ball(String name) {
??????? this.name = name;???????
??? }
?? public void play() {
??????? ball = new Ball("Football");
??????? System.out.println(ball.getName());
??? }
}
杩?涓???璇?涓?瀹规?????般??
绛?妗?: ????"interface Rollable extends Playable, Bounceable"娌℃????棰???interface??缁ф?垮?涓?interfaces锛???浠ヨ???娌¢??????棰??哄??nterface Rollable????"Ball ball = new Ball("PingPang");"??浠讳???nterface??澹版????interface variable (?ュ?e????锛?涔???绉版????????)锛?榛?璁や负public static final??涔?灏辨??璇?Ball ball = new Ball("PingPang");"瀹???涓???"public static final Ball ball = new Ball("PingPang");"????all绫荤??Play()?规?涓?锛?"ball = new Ball("Football");"?瑰??浜?ball??reference锛???杩?????ball?ヨ??Rollable interface锛?Rollable interface????ball??public static final??锛?final??object??涓??借??瑰??reference??????姝ょ?璇??ㄥ???ball = new Ball("Football");"杩????剧ず??????
JAVA 缂?绋?棰?
1锛??板?ㄨ???涓??板??锛?浠ラ???凤???寮?锛??跺???????╁????????搴???搴?锛?????浜ら??灏卞?ㄥ???椤甸?㈡?剧ず??浠?涔???搴?锛?缁???涓猴???渚?reset
import java.util.*;
public class bycomma{
?public static String[] splitStringByComma(String source){
?? if(source==null||source.trim().equals(""))
??? return null;
?? StringTokenizer commaToker = new StringTokenizer(source,",");
?? String[] result = new String[commaToker.countTokens()];
?? int i=0;
?? while(commaToker.hasMoreTokens()){
??? result[i] = commaToker.nextToken();
??? i++;
?? }
?? return result;
?}
?public static void main(String args[]){
?String[] s = splitStringByComma("5,8,7,4,3,9,1");
?int[] ii = new int[s.length];
?for(int i = 0;i<s.length;i++){
?ii[i] =Integer.parseInt(s[i]);
?}
??? Arrays.sort(ii);
??? //asc
??? for(int i=0;i<s.length;i++){
??? System.out.println(ii[i]);
??? }
??? //desc
??? for(int i=(s.length-1);i>=0;i--){
??? System.out.println(ii[i]);
??? }
?}
}
2锛???棰?杞?????挎??浼??板??????棰?杞??㈡??涓??戒?缁???褰㈠?濡?锛?锛?锟?011锛?锛?>锛?涓????朵??句????达?杈??恒??
package test.format;
import java.text.NumberFormat;
import java.util.HashMap;
public class SimpleMoneyFormat {
? public static final String EMPTY = "";
? public static final String ZERO = "??;
? public static final String ONE = "澹?;
? public static final String TWO = "璐?;
? public static final String THREE = "??";
? public static final String FOUR = "??";
? public static final String FIVE = "浼?";
? public static final String SIX = "??";
? public static final String SEVEN = "??";
? public static final String EIGHT = "??";
? public static final String NINE = "??";
? public static final String TEN = "??;
? public static final String HUNDRED = "浣?;
? public static final String THOUSAND = "浠?";
? public static final String TEN_THOUSAND = "涓?";
? public static final String HUNDRED_MILLION = "浜?;
? public static final String YUAN = "??";
? public static final String JIAO = "瑙?";
? public static final String FEN = "??";
? public static final String DOT = "."; ? private static SimpleMoneyFormat formatter = null;
? private HashMap chineseNumberMap = new HashMap();
? private HashMap chineseMoneyPattern = new HashMap();
? private NumberFormat numberFormat = NumberFormat.getInstance(); ? private SimpleMoneyFormat() {
??? numberFormat.setMaximumFractionDigits(4);
??? numberFormat.setMinimumFractionDigits(2);
??? numberFormat.setGroupingUsed(false); ??? chineseNumberMap.put("0", ZERO);
??? chineseNumberMap.put("1", ONE);
??? chineseNumberMap.put("2", TWO);
??? chineseNumberMap.put("3", THREE);
??? chineseNumberMap.put("4", FOUR);
??? chineseNumberMap.put("5", FIVE);
??? chineseNumberMap.put("6", SIX);
??? chineseNumberMap.put("7", SEVEN);
??? chineseNumberMap.put("8", EIGHT);
??? chineseNumberMap.put("9", NINE);
??? chineseNumberMap.put(DOT, DOT); ??? chineseMoneyPattern.put("1", TEN);
??? chineseMoneyPattern.put("2", HUNDRED);
??? chineseMoneyPattern.put("3", THOUSAND);
??? chineseMoneyPattern.put("4", TEN_THOUSAND);
??? chineseMoneyPattern.put("5", TEN);
??? chineseMoneyPattern.put("6", HUNDRED);
??? chineseMoneyPattern.put("7", THOUSAND);
??? chineseMoneyPattern.put("8", HUNDRED_MILLION);
? } ? public static SimpleMoneyFormat getInstance() {
??? if (formatter == null)
????? formatter = new SimpleMoneyFormat();
??? return formatter;
? } ? public String format(String moneyStr) {
??? checkPrecision(moneyStr);
??? String result;
??? result = convertToChineseNumber(moneyStr);
??? result = addUnitsToChineseMoneyString(result);
??? return result;
? } ? public String format(double moneyDouble) {
??? return format(numberFormat.format(moneyDouble));
? } ? public String format(int moneyInt) {
??? return format(numberFormat.format(moneyInt));
? } ? public String format(long moneyLong) {
??? return format(numberFormat.format(moneyLong));
? } ? public String format(Number moneyNum) {
??? return format(numberFormat.format(moneyNum));
? } ? private String convertToChineseNumber(String moneyStr) {
??? String result;
??? StringBuffer cMoneyStringBuffer = new StringBuffer();
??? for (int i = 0; i < moneyStr.length(); i++) {
????? cMoneyStringBuffer.append(chineseNumberMap.get(moneyStr.substring(i, i + 1)));
??? }
??? // ?句桨浠?涓?浜跨???芥??姹?瀛????㈡????????浣?锛???涓?瀹?浠?
??? int indexOfDot = cMoneyStringBuffer.indexOf(DOT);
??? int moneyPatternCursor = 1;
??? for (int i = indexOfDot - 1; i > 0; i--) {
????? cMoneyStringBuffer.insert(i, chineseMoneyPattern.get(EMPTY + moneyPatternCursor));
????? moneyPatternCursor = moneyPatternCursor == 8 ? 1 : moneyPatternCursor + 1;
??? } ??? String fractionPart = cMoneyStringBuffer.substring(cMoneyStringBuffer.indexOf("."));
??? cMoneyStringBuffer.delete(cMoneyStringBuffer.indexOf("."), cMoneyStringBuffer.length());
??? while (cMoneyStringBuffer.indexOf(" ?舵??) != -1) {
????? cMoneyStringBuffer.replace(cMoneyStringBuffer.indexOf("?舵??), cMoneyStringBuffer.indexOf("?舵??) + 2, ZERO);
??? }
??? while (cMoneyStringBuffer.indexOf("?朵桨") != -1) {
????? cMoneyStringBuffer.replace(cMoneyStringBuffer.indexOf("?朵桨"), cMoneyStringBuffer.indexOf("?朵桨") + 2, ZERO);
??? }
??? while (cMoneyStringBuffer.indexOf("?朵?") != -1) {
????? cMoneyStringBuffer.replace(cMoneyStringBuffer.indexOf("?朵?"), cMoneyStringBuffer.indexOf("?朵?") + 2, ZERO);
??? }
??? while (cMoneyStringBuffer.indexOf("?朵?") != -1) {
????? cMoneyStringBuffer.replace(cMoneyStringBuffer.indexOf("?朵?"), cMoneyStringBuffer.indexOf("?朵?") + 2, TEN_THOUSAND);
??? }
??? while (cMoneyStringBuffer.indexOf("?朵嚎") != -1) {
????? cMoneyStringBuffer.replace(cMoneyStringBuffer.indexOf("?朵嚎"), cMoneyStringBuffer.indexOf("?朵嚎") + 2, HUNDRED_MILLION);
??? }
??? while (cMoneyStringBuffer.indexOf("?堕??) != -1) {
????? cMoneyStringBuffer.replace(cMoneyStringBuffer.indexOf("?堕??), cMoneyStringBuffer.indexOf("?堕??) + 2, ZERO);
??? }
??? if (cMoneyStringBuffer.lastIndexOf(ZERO) == cMoneyStringBuffer.length() - 1)
????? cMoneyStringBuffer.delete(cMoneyStringBuffer.length() - 1, cMoneyStringBuffer.length());
??? cMoneyStringBuffer.append(fractionPart); ??? result = cMoneyStringBuffer.toString();
??? return result;
? }
? private String addUnitsToChineseMoneyString(String moneyStr) {
??? String result;
??? StringBuffer cMoneyStringBuffer = new StringBuffer(moneyStr);
??? int indexOfDot = cMoneyStringBuffer.indexOf(DOT);
??? cMoneyStringBuffer.replace(indexOfDot, indexOfDot + 1, YUAN);
? ? ?