javaµÄstring format
×ܵĸñʽÊÇ£º
%[argument_index$][flags][width][.precision]conversion
ÀýÈ磺
%2$-5.2s
//2$£ºÈ¡µÚ¶þ¸ö²ÎÊý
//-: Ö¸¶¨Îª×ó¶ÔÆ룬ĬÈÏÓÒ¶ÔÆë
//5£º×î´óÊä³ö¿í¶ÈΪ20,²»¹»»á²¹¿Õ¸ñ£¬Êµ¼ÊÈô³¬¹ýÔòÈ«²¿Êä³ö
//.2£ºÔڴ˱íʾÊä³ö²ÎÊý2µÄ×î´ó×Ö·ûÊýÁ¿£¬Èç¹ûÊǸ¡µãÊý×Ö£¬Ôò±íʾСÊý²¿·ÖÏÔʾµÄλÊý
//s £º±íʾÊäÈë²ÎÊýÊÇ×Ö·û´®
refs£º
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
Ïà¹ØÎĵµ£º
1¡¢Oracle8/8i/9iÊý¾Ý¿â£¨thinģʽ£©
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl"; //orclΪÊý¾Ý¿âµÄSID
String user="test";
String password="test";
Connection conn= Dri ......
ÕÐƸ-java¸ß¼¶¿ª·¢¹¤³Ìʦ
Ä¿Ç°¹«Ë¾ÒµÎñ·¢Õ¹Ñ¸ËÙ£¬ÐèÒªÓÅÐã¼¼ÊõÈËÔ±µÄ¼ÓÈ룬ÎÒÃǵıê×¼·Ç³£¼òµ¥¡£
ÎÒÃDz»ÒªÇó£º
1¡¢²»ÒªÇóÄãÊÇÃûУ±ÏÒµ¡£
2¡¢²»ÒªÇóÄã¾ßÓÐÈýÄêÒÔÉÏjava¿ª·¢¾Ñ飬µ±È»±ØÒªµÄ¿ª·¢¾ÑéÊÇÒªÓеģ¬·ñÔòÏÂÃæµÄÒªÇóÄãÒ»¶¨´ï²»µ½¡£
3¡¢²»ÒªÇóÄãÁ˽âÆäËû¿ª·¢ÓïÑÔ£¬ÈçC/C++¡¢php¡¢ruby¡£
4¡¢²»ÒªÇóÄ㾫ͨÊý¾Ý¿â ......
1.1.1 ÐÞÁ¶µÚÒ»²ã¾³½ç£º½£Ö¸ËÄ·½£¬ÊÔÎÊÌìÏÂÓëÕù·æ
ÐÞÁ¶µÚÒ»²ã¾³½çµÄ³ÌÐòÔ±£¬¶ÔJava¿ª·¢¼¼Êõ¾¡ÊýÕÆÎÕ£¬¿ª·¢¹¤¾ßÕÆÎÕµÃÒ²½ÏΪæµÊì¡£¿ÉÒÔ½«µÚ¶þ²ã´Î³ÌÐòÔ±½»¸øµÄÈÎÎñÍê³ÉµÃºÜ³öÉ«£¬¿ÉÒÔ°´ÒªÇó¶ÀÁ¢Íê³ÉÀà¡¢½Ó¿ÚºÍËã·¨µÄ¿ª·¢¡£×¢Öؼ¼ÇÉ£¬¶Ô¾ßÌåµÄ±à³ÌÓïÑԷdz£ÊìϤ¡£
ÄÜÁ¦Ö®Ëù¼°£¬½ÔÎÞ²»ÓÃÆ伫¡£ÈÏΪËùÓпª·¢ÖªÊ¶£¬Ô½ÊÇ¿´Æ ......
ÔÚjava.util °üÏÂÃæÓÐÒ»¸öÀà Properties£¬¸ÃÀàÖ÷ÒªÓÃÓÚ¶ÁÈ¡ÒÔÏîÄ¿µÄÅäÖÃÎļþ£¨ÒÔ£®properties½áβµÄÎļþºÍxmlÎļþ£©¡£
PropertiesµÄ¹¹Ô캯ÊýÓÐÁ½¸ö£¬Ò»¸ö²»´ø²ÎÊý£¬Ò»¸öʹÓÃÒ»¸öProperties¶ÔÏó×÷Ϊ²ÎÊý¡£
ʹÓÃProperties¶ÁÈ¡£®propertiesÎļþ
test.propertiesÎļþÈçÏ£º
#²âÊÔ»·¾³ÅäÖãºÆ½Ì¨Â·¾¶ÅäÖÃ
jstrd_home=D:/T ......
Ò». Êý×é
. ÕýÈ·µÄ¶¨Òå: int num[]; num= new int[5] //Ö»ÓÐÓÃnew¹Ø¼ü×ÖÕæÕý´´½¨Êý×éʱ²Å¿ÉÒÔ¸ø¶¨ËüµÄ´óС
´íÎóµÄ¶¨Òå: int num[5];
. ³£¼ûµÄÊý×é´íÎóΪ : ArrayIndexOutOfBoundsException (Êý×éÔ½½ç´íÎó)
. Êý×éµÄά¶ ......