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

java »ù´¡ÖªÊ¶µã»ã×Ü

ÎÊÌâÒ»£ºÎÒÉùÃ÷ÁËʲô£¡
String s = "Hello world!";
Ðí¶àÈ˶¼×ö¹ýÕâÑùµÄÊÂÇ飬µ«ÊÇ£¬ÎÒÃǵ½µ×ÉùÃ÷ÁËʲô£¿»Ø´ðͨ³£ÊÇ£ºÒ»¸öString£¬ÄÚÈÝÊÇ“Hello world!”¡£ÕâÑùÄ£ºýµÄ»Ø´ðͨ³£ÊǸÅÄî²»ÇåµÄ¸ùÔ´¡£Èç¹ûҪ׼ȷµÄ»Ø´ð£¬Ò»°ëµÄÈË´ó¸Å»á»Ø´ð´íÎó¡£
Õâ
¸öÓï¾äÉùÃ÷µÄÊÇÒ»¸öÖ¸Ïò¶ÔÏóµÄÒýÓã¬ÃûΪ“s”£¬¿ÉÒÔÖ¸ÏòÀàÐÍΪStringµÄÈκζÔÏó£¬Ä¿Ç°Ö¸Ïò"Hello
world!"Õâ¸öStringÀàÐ͵ĶÔÏó¡£Õâ¾ÍÊÇÕæÕý·¢ÉúµÄÊÂÇé¡£ÎÒÃDz¢Ã»ÓÐÉùÃ÷Ò»¸öString¶ÔÏó£¬ÎÒÃÇÖ»ÊÇÉùÃ÷ÁËÒ»¸öÖ»ÄÜÖ¸ÏòString¶ÔÏóµÄ
ÒýÓñäÁ¿¡£ËùÒÔ£¬Èç¹ûÔÚ¸Õ²ÅÄǾäÓï¾äºóÃ棬Èç¹ûÔÙÔËÐÐÒ»¾ä£º
String string = s;
ÎÒÃÇÊÇÉùÃ÷ÁËÁíÍâÒ»¸öÖ»ÄÜÖ¸ÏòString¶ÔÏóµÄÒýÓã¬ÃûΪstring£¬²¢Ã»Óеڶþ¸ö¶ÔÏó²úÉú£¬string»¹ÊÇÖ¸ÏòÔ­À´ÄǸö¶ÔÏó£¬Ò²¾ÍÊÇ£¬ºÍsÖ¸Ïòͬһ¸ö¶ÔÏó¡£
ÎÊÌâ¶þ£º"=="ºÍequals·½·¨¾¿¾¹ÓÐʲôÇø±ð£¿
==²Ù×÷·ûרÃÅÓÃÀ´±È½Ï±äÁ¿µÄÖµÊÇ·ñÏàµÈ¡£±È½ÏºÃÀí½âµÄÒ»µãÊÇ£º
int a=10;
int b=10;
Ôòa==b½«ÊÇtrue¡£
µ«²»ºÃÀí½âµÄµØ·½ÊÇ£º
String a=new String("foo");
String b=new String("foo");
Ôòa==b½«·µ»Øfalse¡£
¸ù
¾ÝÇ°Ò»Ìû˵¹ý£¬¶ÔÏó±äÁ¿ÆäʵÊÇÒ»¸öÒýÓã¬ËüÃǵÄÖµÊÇÖ¸Ïò¶ÔÏóËùÔÚµÄÄÚ´æµØÖ·£¬¶ø²»ÊǶÔÏó±¾Éí¡£aºÍb¶¼Ê¹ÓÃÁËnew²Ù×÷·û£¬Òâζ׎«ÔÚÄÚ´æÖвúÉúÁ½¸öÄÚÈÝ
Ϊ"foo"µÄ×Ö·û´®£¬¼ÈÈ»ÊÇ“Á½¸ö”£¬ËüÃÇ×ÔȻλÓÚ²»Í¬µÄÄÚ´æµØÖ·¡£aºÍbµÄÖµÆäʵÊÇÁ½¸ö²»Í¬µÄÄÚ´æµØÖ·µÄÖµ£¬ËùÒÔʹÓÃ"=="²Ù×÷·û£¬½á¹û»áÊÇ
false¡£³ÏÈ»£¬aºÍbËùÖ¸µÄ¶ÔÏó£¬ËüÃǵÄÄÚÈݶ¼ÊÇ"foo"£¬Ó¦¸ÃÊÇ“ÏàµÈ”£¬µ«ÊÇ==²Ù×÷·û²¢²»Éæ¼°µ½¶ÔÏóÄÚÈݵıȽϡ£
¶ÔÏóÄÚÈݵıȽϣ¬ÕýÊÇequals·½·¨×öµÄÊ¡£
¿´Ò»ÏÂObject¶ÔÏóµÄequals·½·¨ÊÇÈçºÎʵÏֵģº
boolean equals(Object o){
return this==o;
}
Object
¶ÔÏóĬÈÏʹÓÃÁË==²Ù×÷·û¡£ËùÒÔÈç¹ûÄã×Ô´´µÄÀàûÓи²¸Çequals·½·¨£¬ÄÇÄãµÄÀàʹÓÃequalsºÍʹÓÃ==»áµÃµ½Í¬ÑùµÄ½á¹û¡£Í¬ÑùÒ²¿ÉÒÔ¿´³ö£¬
ObjectµÄequals·½·¨Ã»Óдﵽequals·½·¨Ó¦¸Ã´ïµ½µÄÄ¿±ê£º±È½ÏÁ½¸ö¶ÔÏóÄÚÈÝÊÇ·ñÏàµÈ¡£ÒòΪ´ð°¸Ó¦¸ÃÓÉÀàµÄ´´½¨Õß¾ö¶¨£¬ËùÒÔObject°Ñ
Õâ¸öÈÎÎñÁô¸øÁËÀàµÄ´´½¨Õß¡£
¿´Ò»ÏÂÒ»¸ö¼«¶ËµÄÀࣺ
Class Monster{
private String content;
...
boolean equals(Object another){ return true;}
}
ÎÒ¸²¸ÇÁËequals·½·¨¡£Õâ¸öʵÏֻᵼÖÂÎÞÂÛMonsterʵÀýÄÚÈÝÈçºÎ£¬ËüÃÇ


Ïà¹ØÎĵµ£º

javaÏß³ÌѧϰÀý×Ó

public class TextDemo {
public static void main(String[] args) {
RunnableEemo r1 = new RunnableEemo();
r1.REemo(r1);
System.out.println(r1.print());
}
}
class RunnableEemo extends ThreadRun implements Runnable {
Thread t2 = null;
public void REemo(RunnableEemo r1) {
Thread t1 = ......

java³£Óü¯ºÏÀàÏê½â

java³£Óü¯ºÏÀàÏê½â£¨ÓÐÀý×Ó£¬¾­µäÄÅ£¡£¡£¡¼¯ºÏÀàºýÍ¿µÄÀ´¿´°¡£¡£¡£©
Collections Framework
¼¯ºÏ¿ò¼ÜÊÇÒ»¸öͳһµÄ¼Ü¹¹,ÓÃÀ´±íʾºÍ²Ù×÷¼¯ºÏ.
¼¯ºÏ¿ò¼ÜÖ÷ÒªÊÇÓɽӿÚ,³éÏóÀàºÍʵÏÖÀ๹³É.
½Ó¿Ú:À¶É«£»ÊµÏÖÀࣺºìÉ«
Collection
|_____Set(HashSet)
|         |_____SortedSet(Tree ......

ʵÏÖjavaµ÷ÓÃc

µÚÒ»ÖÖ·½Ê½²ÉÓÃjni£º
Java²»ÊÇÍêÃÀµÄ£¬JavaµÄ²»×ã³ýÁËÌåÏÖÔÚÔËÐÐËÙ¶ÈÉÏÒª±È´«Í³µÄC++ÂýÐí¶àÖ®Í⣬JavaÎÞ·¨Ö±½Ó·ÃÎʵ½²Ù×÷ϵͳµ×²ã£¨ÈçϵͳӲ¼þµÈ)£¬Îª´ËJavaʹÓÃnative·½·¨À´À©Õ¹Java³ÌÐòµÄ¹¦ÄÜ¡£
¡¡¡¡¿ÉÒÔ½«native·½·¨±È×÷Java³ÌÐòͬ£Ã³ÌÐòµÄ½Ó¿Ú£¬ÆäʵÏÖ²½Ö裺
1.ÔÚJavaÖÐÉùÃ÷native()·½·¨£¬È»ºó±àÒ룻ÀýÈ磺¡¡public ......

javaÄÚ²¿ÀàºÍÄäÃûÀà

ÌáÆðJavaÄÚ²¿ÀࣨInner Class£©¿ÉÄܺܶàÈ˲»Ì«ÊìϤ£¬Êµ¼ÊÉÏÀàËƵĸÅÄîÔÚC++ÀïÒ²ÓУ¬ÄǾÍÊÇǶÌ×ÀࣨNested Class£©£¬¹ØÓÚÕâÁ½ÕßµÄÇø±ðÓëÁªÏµ£¬ÔÚÏÂÎÄÖлáÓжԱȡ£ÄÚ²¿Àà´Ó±íÃæÉÏ¿´£¬¾ÍÊÇÔÚÀàÖÐÓÖ¶¨ÒåÁËÒ»¸öÀࣨÏÂÎĻῴµ½£¬ÄÚ²¿Àà¿ÉÒÔÔںܶàµØ·½¶¨Ò壩£¬¶øʵ¼ÊÉϲ¢Ã»ÓÐÄÇô¼òµ¥£¬Õ§¿´ÉÏÈ¥ÄÚ²¿ÀàËƺõÓÐЩ¶àÓ࣬ËüµÄÓô¦¶ÔÓÚ³õ ......

WindowsÏÂMemcached°²×°¼°Java¿Í»§¶Ëµ÷ÓÃ

WindowsϵÄMemcache°²×°£º
1. ÏÂÔØmemcacheµÄwindowsÎȶ¨°æ£¬½âѹ·Åij¸öÅÌÏÂÃ棬±ÈÈçÔÚc:\memcached
2. ÔÚÖնˣ¨Ò²¼´cmdÃüÁî½çÃ棩ÏÂÊäÈë ‘c:\memcached\memcached.exe -d install’ °²×°
3. ÔÙÊäÈ룺 ‘c:\memcached\memcached.exe -d start’ Æô¶¯¡£NOTE: ÒÔºómemcached½«×÷ΪwindowsµÄÒ»¸ö· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ