Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JAVAÖÐ×Ö·û´®ÖªÊ¶Ïê½â

javaÖÐ×Ö·û´®ºÍÕûÐÍÖ®¼äµÄת»¯
1£©ÈçºÎ½«×Ö·û´®×ª»¯ÎªÕûÐÍ£»
   int i = Integer.parseInt(String str);
   int i = Integer.valueOf().intValue();
 
  ×¢£ºInteger.parseIn ºÍ Integer.valueOf ²»Í¬£¬Ç°ÕßÉú³ÉµÄÊÇÕûÐÍ£¬¶øºóÕßÊÇÒ»¸ö¶ÔÏó£¬ËùÒÔҪͨ¹ýintValue()À´»ñµÃ¶ÔÏóµÄÖµ£»
  ×Ö´®×ª³É Double, Float, Long µÄ·½·¨´óͬСÒì.
2) ÕûÐÍת»¯Îª×Ö·û´®
   String str = String.valueOf(int i);
   String str = Integer.toString(int i);
   String str = "" + i ;
  ×¢£º Double, Float, Long µÄ·½·¨´óͬСÒì.
 
1. Ê×ÏÈString²»ÊôÓÚ8ÖÖ»ù±¾Êý¾ÝÀàÐÍ£¬StringÊÇÒ»¸ö¶ÔÏó¡£
¡¡¡¡ÒòΪ¶ÔÏóµÄĬÈÏÖµÊÇnull£¬ËùÒÔStringµÄĬÈÏÖµÒ²ÊÇnull£»µ«ËüÓÖÊÇÒ»ÖÖÌØÊâµÄ¶ÔÏó
£¬ÓÐÆäËü¶ÔÏóûÓеÄһЩÌØÐÔ¡£
2. new String()ºÍnew String(“”)¶¼ÊÇÉêÃ÷Ò»¸öеĿÕ×Ö·û´®£¬ÊÇ¿Õ´®²»ÊÇnull£»
3. String str=”kvill”£»
String str=new String (“kvill”);µÄÇø±ð£º
¡¡¡¡ÔÚÕâÀÎÒÃDz»Ì¸¶Ñ£¬Ò²²»Ì¸Õ»£¬Ö»Ïȼòµ¥ÒýÈë³£Á¿³ØÕâ¸ö¼òµ¥µÄ¸ÅÄî¡£
¡¡¡¡³£Á¿³Ø(constant pool)Ö¸µÄÊÇÔÚ±àÒëÆÚ±»È·¶¨£¬²¢±»±£´æÔÚÒѱàÒëµÄ.classÎļþÖеÄ
һЩÊý¾Ý¡£Ëü°üÀ¨Á˹ØÓÚÀà¡¢·½·¨¡¢½Ó¿ÚµÈÖеij£Á¿£¬Ò²°üÀ¨×Ö·û´®³£Á¿¡£
¡¡¡¡¿´Àý1£º
String s0=”kvill”;
String s1=”kvill”;
String s2=”kv” + “ill”;
System.out.println( s0==s1 );
System.out.println( s0==s2 );
¡¡¡¡½á¹ûΪ£º
true
true
¡¡¡¡Ê×ÏÈ£¬ÎÒÃÇÒªÖªµÀJava»áÈ·±£Ò»¸ö×Ö·û´®³£Á¿Ö»ÓÐÒ»¸ö¿½±´¡£
¡¡¡¡ÒòΪÀý×ÓÖеÄs0ºÍs1ÖеĔkvill”¶¼ÊÇ×Ö·û´®³£Á¿£¬ËüÃÇÔÚ±àÒëÆھͱ»È·¶¨ÁË£¬ËùÒÔ
s0==s1Ϊtrue£»¶ø”kv”ºÍ”ill”Ò²¶¼ÊÇ×Ö·û´®³£Á¿£¬µ±Ò»¸ö×Ö·û´®Óɶà¸ö×Ö·û´®³£Á¿Á¬
½Ó¶ø³Éʱ£¬Ëü×Ô¼º¿Ï¶¨Ò²ÊÇ×Ö·û´®³£Á¿£¬ËùÒÔs2ҲͬÑùÔÚ±àÒëÆھͱ»½âÎöΪһ¸ö×Ö·û´®³£
Á¿£¬ËùÒÔs2Ò²Êdz£Á¿³ØÖДkvill”µÄÒ»¸öÒýÓá£
¡¡¡¡ËùÒÔÎÒÃǵóös0==s1==s2;
¡¡¡¡ÓÃnew String() ´´½¨µÄ×Ö·û´®²»Êdz£Á¿£¬²»ÄÜÔÚ±àÒëÆÚ¾ÍÈ·¶¨£¬ËùÒÔnew String()
´´½¨µÄ×Ö·û´®²»·ÅÈë³£Á¿³ØÖУ¬ËüÃÇÓÐ×Ô¼ºµÄµØÖ·¿Õ¼ä¡£
¡¡¡¡¿´Àý2£º
String s0=”kvill”;
String s1=new String(”kvill”);


Ïà¹ØÎĵµ£º

java file io

ʹÓÃJava²Ù×÷Îı¾ÎļþµÄ·½·¨Ïê½â
ÕªÒª: ×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀà
×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀ࣬ÕâÁ½¸öÀ඼ÊdzéÏóÀ࣬WriterÖÐ write(char[] ch,int off,int
length)£¬flush()ºÍclose()·½·¨Îª³éÏó·½· ......

ÖÂJavaÐÂÊÖµÄÒ»·âЊת

ÏÂÃæÕâƪÎÄÕÂÊÇ̨ÍåÖøÃûJavaÂÛ̳“Javaworld”µÄÒ»¸ö×ÊÉî°æÖ÷дµÄÒ»·â¶ÔJavaÐÂÊÖµÄÐÅ£¬Ï£ÍûС×é³ÉÔ±×Ðϸ¿´Ï Äã»áѧµ½ºÜ¶àµÄ¡¢¡¢¡¢¡¢
親愛µÄ java ÐÂÊÖ們 :
ºÜ¸ß興Äã們願Òâ來這裡¹²Í¬學習,
Java 這個語ÑÔ, Ò ......

Java Logger»ã×Ü

À´×Ô£ºhttp://www.cnblogs.com/echozhjun/archive/2010/01/08/1641970.html
JDK Logger
JDK LoggerÔÚjava.util.logging°üÏÂÃ棬×Ô´ÓJDK1.4¾ÍÓÐÁË£¬¿ÉÊÇÒòΪlog4jµÄ´æÔÚ£¬Õâ¸öLoggerÒ»Ö±³ÁĬ×Å¡£Java×Ô´øµÄLogger£¬¼¶±ð±ÈLog4j»¹ÒªÏêϸ£¬µ«ÊÇÈç¹ûÐèÒª×Ô¶¨ÒåÈÕÖ¾Êä³ö¸ñʽ£¬ÐèÒª×Ô¼ºÊµÏÖFormatter£¬ÓÐЩ²»·½±ã¡£
Log4j  ......

javaÒì³£¸ÐÊÜ

½ñÌìÀ´½²Ï¹ØÓÚJavaÒì³£ÎÊÌâ¡£ÆäʵÔÚ¿ª·¢¹ý³ÌÖÐJavaµÄÒì³£´¦Àí²¢Ã»ÓÐÏëÏóÖеÄÄÇô¼òµ¥£¬¼òµ¥µÄ˵Java²»×ãÖ®´¦£¬ÄÇôÒì³£´¦Àí»úÖÆÒ²¿ÉÒÔËãÒ»¸ö£¨¸öÈ˹۵㣩¡£ÎªÊ²Ã´ÎÒ»áÕâÑùÈÏΪÄØ£¿ÏÂÃæÎÒ½«ÔÚ¿ª·¢¹ý³ÌÖÐÓÃ×Ô¼ºµÄ˼ά·½Ê½À´½âÊÍÏÂÒ쳣ʹÓá£
JavaµÄÒì³£´óÖ·ÖΪ3Àࣺ
ExceptionÀà¡¢RuntimeExceptionÀàºÍErrorÀ࣬£¨¾ßÌåÒâË ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ