Ò»¡¢Àà×°ÔØÆ÷£ºÍ¨¹ý·Ö±ðʹÓò»Í¬µÄÀà×°ÔØÆ÷×°ÔØ¿É¿¿µÄ°üºÍ²»¿É¿¿µÄ°üÀ´ÊµÏÖ°² È«ÐÔ¡£
ÔÚ1.2°æ±¾µÄJavaÐéÄâ»ú¿ªÊ¼ÔËÐÐʱ£¬ÔÚÓ¦ÓóÌÐòÆô¶¯ÒÔÇ°£¬ËüÖÁÉÙ´´½¨Ò»¸öÓû§×Ô¶¨ÒåÀà×°ÔØÆ÷£¬Ò²¿ÉÄÜÊǶà¸ö¡£ËùÓÐÕâЩÀà×°ÔØÆ÷±»Á¬½ÓÔÚÒ»¸öË«Ç×--º¢×ӵĹØϵÁ´ÖУ¬ÔÚÕâÌõÁ´µÄ¶¥¶ËÊÇÆô¶¯Àà×°ÔØÆ÷£¬Ä©¶ËÊÇÒ»¸ö±»³ÆΪ“ϵͳÀà×°ÔØÆ÷”µÄÀà×°ÔØÆ÷¡£
ÔÚÓÐË«Ç×ίÅÉģʽÏ£¬Æô¶¯Àà×°ÔØÆ÷¿ÉÒÔÇÀÔÚ±ê×¼À©Õ¹Àà×°ÔØÆ÷֮ǰȥװÔØÀ࣬¶ø±ê×¼À©Õ¹Àà×°ÔØÆ÷¿ÉÒÔÇÀÔÚÀà·¾¶Àà×°ÔØÆ÷֮ǰȥװÔØÄǸöÀ࣬Àà·¾¶Àà×°ÔØÆ÷ÓÖ¿ÉÒÔÇÀÔÚÍøÂçÀà×°ÔØÆ÷֮ǰȥװÔØËü¡£ÕâÑù£¬Æô¶¯Àà×°ÔØÆ÷»áÔÚ×î¿ÉÐŵÄÀà¿â—JAVA ºËÐÄAPI—ÖÐÊ×Ïȼì²éÿ¸ö±»×°ÔصÄÀàÐÍ£¬È»ºó£¬²ÅÒÀ´Îµ½±ê×¼À©Õ¹¡¢Àà·¾¶Éϵı¾µØÀàÎļþÖмì²é¡£
JavaÐéÄâ»úÖ»°Ñ±Ë´Ë·ÃÎʵÄÌØÊâȨÏÞÊÚÓèÓÉͬһ¸öÀà×°ÔØÆ÷×°Ôص½Í¬Ò»¸ö°üÖеÄÀàÐÍ¡£
ËùÓеÄjavaÐéÄâ»úʵÏÖ±ØÐëÔÚÿһ¸öÀà»ò½Ó¿ÚÊ×´ÎÖ÷¶¯Ê¹ÓÃʱ³õʼ»¯¡£ÏÂÃæÕâÁùÖÖÇéÐηûºÏÖ÷¶¯Ê¹ÓõÄÒªÇó£º
w µ±´´½¨Ä³¸öÀàµÄÐÂʵÀýʱ£¨»òÕßͨ¹ýÔÚ×Ö½ÚÂëÖÐÖ´ÐÐnewÖ¸Á»òÕßͨ¹ý²»Ã÷È·µÄ´´½¨¡¢·´Éä¡¢¿Ë¡»òÕß·´ÐòÁл¯£©¡£
w &n ......
¡¡¡¡Java±à³ÌÖеÄÒì³£´¦ÀíÊÇÒ»¸öºÜ³£¼ûµÄ»°ÌâÁË£¬¼¸ºõÈκÎһÎéÉÜÐÔµÄJava¿Î³Ì¶¼»áÌáµ½Òì³£´¦Àí¡£²»¹ý£¬ÎÒÈÏΪºÜ¶àÈËÆäʵ²¢Ã»ÓÐÕæÕýÕÆÎÕÕýÈ·´¦ÀíÒì³£Çé¿öµÄ·½·¨ºÍ²ßÂÔ£¬×î¶àÒ²¾Í²»¹ýÁ˽â¸ö´ó¸Å£¬ÖªµÀµã¸ÅÄî¡£±¾ÎľͶÔÈýÖÖ²»Í¬³Ì¶ÈºÍÖÊÁ¿µÄJavaÒì³£´¦Àí½øÐÐÁËÌÖÂÛ£¬Ëù²ûÊöµÄ´¦ÀíÒì³£µÄ·½Ê½°´ÊÖ·¨µÄ¸ßÏ·ÖΪ£ººÃ£¬²»ºÃºÍ¶ñÁÓÈýÖÖ¡£Í¬Ê±ÏòÄãÌṩÁËһЩ½â¾öÕâЩÎÊÌâµÄ¼¼ÇÉ¡£
¡¡¡¡Ê×ÏȽâÊÍһЩjavaÒì³£´¦ÀíÖбØÐë¸ãÇå³þµÄ¶¨ÒåºÍ»úÖÆ¡£JavaÓïÑԹ淶½«×ÔErrorÀà»òRuntimeExceptionÀàÑÜÉú³öÀ´µÄÈκÎÎ¥Àý¶¼³Æ×÷“²»¿É¼ì²é”(Unchecked)Òì³£;ÆäËûËùÓÐÒì³£Ôò³Æ×÷“¿É¼ì²é”(Checked)Òì³£¡£
¡¡¡¡Ëùν¿É¼ì²éÒì³££¬ÊÇÖ¸ÎÒÃÇÓ¦¸Ã×ÔÐд¦ÀíµÄÒì³£¡£ÖÁÓÚ´¦ÀíµÄÊֶΣ¬ÒªÃ´¼ÓÒÔ¿ØÖÆ(try catch)£¬ÒªÃ´Í¨¸æ(throws)ËûÃÇÓпÉÄܲúÉú¡£Í¨³££¬Ó¦²¶×½ÄÇЩÒÑÖªÈçºÎ´¦ÀíµÄÒì³££¬¶øͨ¸æÄÇЩ²»ÖªÈçºÎ´¦ÀíµÄÒì³£¡£
¡¡¡¡¶ø¶ÔÄÇЩ²»¿É¼ì²éÒì³£À´Ëµ£¬ËûÃÇҪôÔÚÎÒÃǵĿØÖÆÖ®Íâ(Error),ҪôÊÇÎÒÃÇÊ×ÏȾͲ»¸ÃÔÊÐíµÄÇé¿ö(RuntimeException).ÖÁÓÚÒì³£µÄÖ¸¶¨£¬JavaµÄ¹æÔò·Ç³£¼òµ¥£ºÒ»¸ö·½·¨±ØÐëͨ¸æ×Ô¼º¿ÉÄܲúÉúµÄËùÓпɼì²éÒì³£¡£
¡¡¡¡±àд×Ô¼ºµÄ·½·¨Ê±£¬²¢²»Ò»¶¨ÒªÍ¨¸æ³ö·½·¨Êµ¼Ê¿ÉÄܲúÉúµÄ ......
private PreparedStatement pstmt;
String sql="INSERT INTO TABLE(id,Ãû³Æ,Óû§id,Stbid,MAC,Óû§×´Ì¬,×Ü´ÎÊý,IpµØÖ·,×ÊÁϸüÐÂʱ¼ä) " +
"VALUES(?,?,?,?,?,?,?,?,?)";
pstmt=connection.prepareStatement(sql);
pstmt.setString(1,array[0]);
pstmt.setString(2, array[1]);
pstmt.setString(3, array[2]);
pstmt.setString(4, array[3]);
pstmt.setString(5, array[4]);
pstmt.setString(6, array[5]);
pstmt.setString(7, array[6]);
pstmt.setString(8, array[7]);
pstmt.setString(9, array[8]);
pstmt.executeUpdate();
pstmt.close();
connection.commit();
ÆäÖÐTABLEÖеĸ÷×ֶεÄÀàÐ;ùΪCharÀàÐÍ¡£ ......
java ÐÞÊηûºÍ·ÃÎÊȨÏÞ½éÉÜ
ÐÞÊηû½éÉÜ£º
public
ʹÓöÔÏó:Àà¡¢½Ó¿Ú¡¢³ÉÔ±±äÁ¿¡¢·½·¨
½éÉÜ:ÎÞÂÛËüËù´¦ÔÚ°ü¶¨ÒåÔÚÄĸÃÀà(½Ó¿Ú¡¢³ÉÔ±)¶¼ÊÇ¿É·ÃÎÊ
protected
ʹÓöÔÏó:³ÉÔ±±äÁ¿¡¢·½·¨
½éÉÜ:³ÉÔ±±äÁ¿Ö»ÄÜÔÚ¶¨ÒåËü°üÖб»·ÃÎÊ£¬Èç¹ûÔÚÆäËû°üÖб»·ÃÎÊ£¬ÔòʵÏÖÕâ¸ö˼··½·¨Àà±ØÐëÊǸóÉÔ±ËùÊôÀà×ÓÀà
private
ʹÓöÔÏó:³ÉÔ±±äÁ¿¡¢³ÉÔ±·½·¨
½éÉÜ:³ÉÔ±±äÁ¿ºÍ·½·¨¶¼Ö»ÄÜÔÚ¶¨ÒåËüÀàÖб»·ÃÎÊ£¬ÆäËûÀ඼·ÃÎʲ»µ½¡£¶Ô³ÉÔ±±äÁ¿µÄ½øÐлñÈ¡ºÍ¸ü¸Ä£¬Ò»°ãÓÃget() set() public ·½·¨¡£ÊµÏÖÁËJavaÃæÏò¶ÔÏóµÄ·âװ˼Ïë¡£
friendly£¨È±Ê¡£©
ʹÓöÔÏó:Àà¡¢·½·¨¡¢³ÉÔ±±äÁ¿
½éÉÜ£º·ÃÎÊȨÏÞÓëprotectedÏàËÆ£¬µ«ÐÞÊÎÀà³ÉԱʱ²»Í¬°üÖеÄ×ÓÀ಻ÄÜ·ÃÎÊ¡£
static
ʹÓöÔÏó:·½·¨¡¢³ÉÔ±±äÁ¿
½éÉÜ:ÐÞÊαäÁ¿,³ÆΪÀà±äÁ¿»ò¾²Ì¬±äÁ¿¡£¾²Ì¬±äÁ¿ÊǺÍÀà´æÔÚÒ»ÆðµÄ,ÿ¸öʵÀý¹²ÏíÕâ¸ö¾²Ì¬±äÁ¿.ÔÚÀà¼ÓÔØʱ³õʼ»¯¡£
final
ʹÓöÔÏó:Àà¡¢·½·¨¡¢³ÉÔ±±äÁ¿
½éÉÜ:Ò»µ©¶¨ÒåΪfina£¬¾Í²»Äܱ»ÐÞ¸ÄÁË¡£±»ÉùÃ÷ΪfinalµÄ±äÁ¿±ØÐëÔÚÉùÃ÷ʱ¸ø¶¨³õÖµ£¬¶øÔÚÒÔºóµÄÒýÓÃÖÐÖ»ÄܶÁÈ¡²»Äܸü¸Ä¡£ÐÞÊÎÀàÊDz»ÄÜÅÉÉú³ö×ÓÀ࣬ÐÞÊη½·¨Ê±£¬²»Äܱ»µ±Ç°×ÓÀàµÄ·½·¨¸²¸Ç
abstract
ʹÓöÔÏó:Àà¡¢½Ó¿Ú¡¢·½·¨
½éÉÜ:ÐÞÊÎÀàʱ£¬±»³ÆΪ³éÏóÀ ......
Ê×ÏÈÃ÷ȷһϣºjavaÀïÃæÖ»ÓÐÖµ´«µÝ£¬ÒýÓô«µÝÖ»ÊÇÒ»Ö»Îó¶Á¶øÒÑ¡£
À´¿´Ò»¸öÀý×Ó£º
public static void main(String[] args)
{
StringBuffer str1 = new StringBuffer("hello");
test(str1);
System.out.println("main : " + str1);
}
public static void test(StringBuffer str)
{
StringBuffer tempStr = new StringBuffer();
System.out.println("first : " + str);
str = str.append(" world");
System.out.println("second: " + str);
str = tempStr;
System.out.println("third : " + str);
}
½á¹û
first : hello
second: hello world
third :
main : hello world
Ç°ÃæÈý¸ö´òÓ¡½á¹û¶¼ºÜºÃÀí½â£¬×îºóÒ»¸ömainÀïÃæ´òÓ¡³öµÄΪʲôÊÇ hello worldÄØ£¿
ÈÃÎÒÃÇÒ»²½Ò»²½À´·ÖÎö£º
test(str1);
µ÷ÓÃtest()·½·¨¡£StringBuffer ¶ÔÏó("hello")µÄÒýÓÃ×öΪ²ÎÊý´«¸øtest()·½·¨¡£ÓÐÈ˾ÍÒªÎÊÁË£ºÄãÕâÀï²»¾ÍÊÇ´«µÄÒ ......
JAVA¿ª·¢Õß×ȥµÄ20¸öÓ¢ÎÄÍøÕ¾
1.[http://www.javaalmanac.com] – Java¿ª·¢ÕßÄê¼øÒ»ÊéµÄÔÚÏß°æ±¾. ÒªÏë¿ìËٲ鵽ijÖÖJava¼¼ÇɵÄÓ÷¨¼°Ê¾Àý´úÂë, ÕâÊÇÒ»¸ö²»´íµÄÈ¥´¦.
2.[http://www.onjava.com] – O’ReillyµÄJavaÍøÕ¾. ÿÖܶ¼ÓÐÐÂÎÄÕÂ.
3.[http://java.sun.com] – ¹Ù·½µÄJava¿ª·¢ÕßÍøÕ¾ – ÿÖܶ¼ÓÐÐÂÎÄÕ·¢±í.
4.[http://www.developer.com/java] – ÓÉGamelan.com ά»¤µÄJava¼¼ÊõÎÄÕÂÍøÕ¾.
5.[http://www.java.net] – Sun¹«Ë¾Î¬»¤µÄÒ»¸öJavaÉçÇøÍøÕ¾.
6.[http://www.builder.com] – CnetµÄBuilder.comÍøÕ¾ – ËùÓеļ¼ÊõÎÄÕÂ, ÒÔJavaΪÖ÷.
7.[http://www.ibm.com/developerworks/java] – IBMµÄDeveloperworks¼¼ÊõÍøÕ¾; ÕâÊÇÆäÖеÄJava¼¼ÊõÖ÷Ò³.
8.[http://www.javaworld.com] – ×îÔçµÄÒ»¸öJavaÕ¾µã. ÿÖܸüÐÂJava¼¼ÊõÎÄÕÂ.
9.[http://www.devx.com/java] – DevXά»¤µÄÒ»¸öJava¼¼ÊõÎÄÕÂÍøÕ¾.
10.[http://www.fawcette.com/javapro] – JavaProÔÚÏßÔÓÖ¾ÍøÕ¾.
11.[http://www.sys-con.com/java] – Java Developers JournalµÄÔÚÏßÔÓÖ¾ÍøÕ¾.
12.[htt ......