JAVA¹æÔò »ù´¡Æª
±¾ÎĽéÉܵÄJAVA¹æÔòµÄ˵Ã÷·ÖΪ5¸ö¼¶±ð£¬¼¶±ð1ÊÇ×î»ù±¾Ò²ÊÇ×îÖØÒªµÄ¼¶±ð£¬ÔÚ½ñºó½«Â½Ðøд³öÆäËûµÄ¹æÔò¡£×ñÊØÁËÕâЩ¹æÔò¿ÉÒÔÌá¸ß³ÌÐòµÄЧÂÊ¡¢Ê¹´úÂëÓиüºÃµÄ¿É¶ÁÐԵȡ£
£¨1£© ±ÜÃâʹÓÃNEW¹Ø¼ü×ÖÀ´´´½¨String¶ÔÏó¡£
°ÑÒ»¸öString³£Á¿copyµ½String ¶ÔÏóÖÐͨ³£ÊǶàÓà¡¢ÀË·Ñʱ¼äµÄ
Public class test{
Public void method(){
System.out.print (str);
}
private String str = new String ("1"); //ÕâÀïн¨¶ÔÏóÊÇÍêȫûÓбØÒªµÄ
private String str2=”2” //ÕýÈ·µÄÓ¦¸ÃÈç´Ë
}
²Î¿¼£ºJoshua Bloch: "Effective Java - Programming Language Guide"
£¨2£© ±ÜÃâʹÓò»±ØÒªµÄǶÌס£
¹ý¶àµÄǶÌ×»áʹÄãµÄ´úÂ븴ÔÓ»¯£¬¼õÈõ¿É¶ÁÐÔ¡£
Public class test {
String add (){
Int c=(a=a+b)+b; //¹ýÓÚ¸´ÔÓ
Return c
}
}
²Î¿¼£ºhttp://java.sun.com/docs/codeconv/html/CodeConventions.doc9.html#177
£¨3£© ±ÜÃâÔÚͬһÐÐÉùÃ÷²»Í¬ÀàÐ͵Ķà¸ö±äÁ¿
ÕâÑù¿ÉÒÔʹ³ÌÐò¸ü¼ÓÇåÎú£¬±ÜÃâ»ìÂÒ
private int index, index1[];
ÕýÈ·µÄÓ¦¸ÃÈç´Ë£º
private int index;
private int index1[];
²Î¿¼£ºhttp://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html#2992
(4) ÔÚÿһÐÐÀïдһÌõÓï¾ä
ÕâÌõ¹æÔò²»°üÀ¨forÓï¾ä£º±ÈÈ磺'for (int i = 0; i < 10; i++) x--;’¿ÉÒÔÔö¼Ó´úÂëµÄ¿É¶ÁÐÔ¡£
public class OSPL {
int method (int a, int b) {
int i = a + b; return i; // ¿É¶ÁÐÔ²»Ç¿
}
ÕýÈ·µÄ£º
public class OSPLFixed {
int method (int a, int b) {
int i = a + b;
return i;
}
}
²Î¿¼£ºSection 7.1 of http://java.sun.com/docs/codeconv/html/CodeConventions.doc6.html#431
£¨5£©¾³£´Ófinalize ()Öе÷ÓÃsuper.finalize ()
ÕâÀïµÄfinalize ()ÊÇjavaÔÚ½øÐÐÀ¬»øÊÕ¼¯µÄʱºòµ÷Óõģ¬ºÍfinally²»Ò»Ñù¡£Èç¹ûÄãµÄ¸¸ÀàûÓж¨Òåfinally£¨£©µÄ»°£¬ÄãÒ²Ó¦¸Ãµ÷Óá£ÕâÀïÓÐÁ½¸öÔÒò£º£¨1£
Ïà¹ØÎĵµ£º
¡¡¡¡ÔÚƽʱ¹¤×÷ÖУ¬ÄÑÃâ»áÓöµ½°Ñ XML ×÷ΪÊý¾Ý´æ´¢¸ñʽ¡£Ãæ¶ÔÄ¿Ç°ÖÖÀà·±¶àµÄ½â¾ö·½°¸£¬Äĸö×îÊʺÏÎÒÃÇÄØ£¿ÔÚÕâƪÎÄÕÂÖУ¬ÎÒ¶ÔÕâËÄÖÖÖ÷Á÷·½°¸×öÒ»¸ö²»ÍêÈ«ÆÀ²â£¬½ö½öÕë¶Ô±éÀú XML Õâ¿éÀ´²âÊÔ£¬ÒòΪ±éÀú XML Êǹ¤×÷ÖÐʹÓÃ×î¶àµÄ£¨ÖÁÉÙÎÒÈÏΪ£©¡£
¡¡¡¡Ô¤ ±¸
¡¡¡¡²âÊÔ»·¾³£º
¡¡¡¡AMD ¶¾Áú1.4G OC 1.5G¡¢256M DDR333¡¢Wind ......
public class OuterClass
{
public class InnerClass
{
public int code = 100;
}
public static void main(String[] args)
{
OuterClass outer = new OuterClass();
OuterClass.InnerClass o = outer.new InnerClass();
System. ......
1¡¢ÃæÏò¶ÔÏóµÄÌØÕ÷ÓÐÄÄЩ·½Ãæ
1.³éÏ󣺳éÏó¾ÍÊǺöÂÔÒ»¸öÖ÷ÌâÖÐÓ뵱ǰĿ±êÎ޹صÄÄÇЩ·½Ã棬ÒÔ±ã¸ü³ä·ÖµØ×¢ÒâÓ뵱ǰĿ±êÓйصķ½Ãæ¡£³éÏó²¢²»´òËãÁ˽âÈ«²¿ÎÊÌ⣬¶øÖ»ÊÇÑ¡ÔñÆäÖеÄÒ»²¿·Ö£¬ÔÝʱ²»Óò¿·Öϸ½Ú¡£³éÏó°üÀ¨Á½¸ö·½Ã棬һÊǹý³Ì³éÏ󣬶þÊÇÊý¾Ý³éÏó¡£
2.¼Ì³Ð£º¼Ì³ÐÊÇÒ»ÖÖÁª½áÀàµÄ²ã´ÎÄ£ÐÍ£¬²¢ÇÒÔÊÐíºÍ ......
1 Áо٠10¸öjavaÓïÑÔµÄÓÅÊÆ
Ãâ·Ñ£¬¿ªÔ´£¬¿çƽ̨£¬¼òµ¥Ò×Ó㬹¦ÄÜÍêÉÆ£¬ÃæÏò¶ÔÏ󣬽¡×³ÐÔ£¬¶àỊ̈߳¬½á¹¹ÖÐÁ¢£¬
ÆóÒµÓ¦ÓõijÉÊìƽ̨£¬ÎÞÏßÓ¦Óá£
2 ÁоÙjavaÖÐ 10¸öÃæÏò¶ÔÏó±à³ÌµÄÊõÓï
°ü£¬À࣬ʵÀý£¬·â×°£¬¼Ì³Ð£¬¶à̬£¬ÖØÔØ£¬ÖØд£¬¶Ô ......
ÔÚ¿Í»§/·þÎñÆ÷ͨÐÅģʽÖУ¬¿Í»§¶ËÖ÷¶¯´´½¨Óë·þÎñÆ÷Á¬½ÓµÄSocket£¬·þÎñÆ÷ÊÕµ½¿Í»§¶ËµÄÁ¬½ÓÇëÇó£¬Ò²´´½¨ÁËÓë¿Í»§¶ËÁ¬½ÓµÄSocket¡£
¿Í»§¶ËÖ÷¶¯´´½¨Socketʱºò£¬ÐèÒª×öÏÂÃæһЩÊÂÇ飺
1. ¹¹ÔìSocket.
2. É趨µÈ´ý½¨Á¢Á¬½ÓµÄ³¬Ê±Ê±¼ä
&nb ......