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

javaÃæÊÔÖÐһЩString³£¼ûÎÊÌâ


String s = new String("abc");   
String s1 = "abc";   
String s2 = new String("abc");   
  
System.out.println(s == s1);   
System.out.println(s == s2);   
System.out.println(s1 == s2);  
String s = new String("abc");
String s1 = "abc";
String s2 = new String("abc");
System.out.println(s == s1);
System.out.println(s == s2);
System.out.println(s1 == s2);
ÇëÎÊÒÔÉϳÌÐòÖ´Ðнá¹ûÊÇʲô£¿
µÚÒ»¾äÖ´ÐкóÄÚ´æÖÐÓÐÁ½¸ö¶ÔÏ󣬶ø²»ÊÇÒ»¸ö¡£Ò»¸öÓÉnew String("abc")ÖеÄ"abc"ÔÚString PoolÀïÉú³ÉÒ»¸öֵΪ"abc"µÄ¶ÔÏó£»µÚ¶þ¸öÓÉnewÔÚ¶ÑÀï²úÉúÒ»¸öֵΪ"abc"µÄ¶ÔÏ󣬸öÔÏóÍêÈ«ÊÇString PoolÀïµÄ"abc"µÄÒ»¸ö¿½±´¡£±äÁ¿s×îºóÖ¸Ïò¶ÑÖвúÉúµÄ"abc"¶ÔÏó£»
µÚ¶þ¾äÖ´ÐÐʱ£¬s1ÏÈÈ¥String PoolÕÒÊÇ·ñÓÐֵΪ"abc"µÄ¶ÔÏ󣬺ÜÏÔÈ»ÔÚÉÏÒ»²½ÖÐjavaÒѾ­ÔÚString PoolÀïÉú³ÉÒ»¸ö"abc"¶ÔÏóÁË£¬ËùÒÔs1Ö±½ÓÖ¸ÏòString PoolÖеÄÕâ¸ö"abc"£»
µÚÈý¾äÖÐÓÖÓÐÒ»¸önew£¬ÔÚjavaÖз²Óöµ½newʱ£¬¶¼»áÔÚ¶ÑÀï²úÉúÒ»¸öеĶÔÏó¡£Òò´Ë£¬¸Ã¾äÖ´Ðкó¶ÑÀïÓÖ¶àÁËÒ»¸ö"abc"¶ÔÏó£¬ÕâÓëÖ´ÐеÚÒ»¾äºóÉú³ÉµÄ"abc"ÊDz»Í¬µÄÁ½¸ö¶ÔÏó£¬s2×îºóÖ¸ÏòÕâ¸öÐÂÉú³ÉµÄ¶ÔÏó¡£
Òò´Ë£¬Ö´ÐкóÃæµÄ´òÓ¡Óï¾äµÄ½á¹ûÊÇÈý¸öfalse
ÎÊÌâ2:
Java´úÂë
System.out.println(s == s.intern());   
System.out.println(s1 == s1.intern());   
System.out.println(s1.intern() == s2.intern());  
System.out.println(s == s.intern());
System.out.println(s1 == s1.intern());
System.out.println(s1.intern() == s2.intern());
ÇëÎÊÒÔÉϳÌÐòÖ´Ðнá¹ûÊÇʲô£¿
ÉèsΪStringÀàÐ͵ıäÁ¿£¬µ±Ö´ÐÐs.intern()ʱ£¬javaÏÈÔÚString PoolÀïÕÒÓë×Ö·û´®±äÁ¿sÏàµÈ(ÓÃequals()·½·¨)µÄ×Ö·û´®£¬ÈôÓÐÔò½«ÆäÒýÓ÷µ»Ø£»ÈôûÓÐÔòÔÚString PoolÀï´´½¨Ò»¸öÓësµÄÖµÏàµÈµÄ×Ö·û´®¶ÔÏ󣬲¢½«ÆäÒýÓ÷µ»Ø¡£´ÓÖÐÎÒÃÇ¿ÉÒÔ×ܽá³öintern()·½·¨ÎÞÂÛÈçºÎ¶¼½«·µ»ØString PoolÀïµÄ×Ö·û´®¶ÔÏóµÄÒýÓá£
Òò´Ë£¬ÒÔÉϳÌÐòÖ´ÐеĽá¹ûÊÇfalse£¬true£¬true¡£
PS:ÉèsºÍtΪÁ½¸ö×Ö·û´®±äÁ¿£¬ÈôÓÐs.equals(t)£¬±ØÓÐs.intern() == t.intern()£»
PS:"=="ÓÀÔ¶±È½ÏµÄÊÇÁ½±ß¶ÔÏóµÄµØÖ·ÊÇ·


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

Java ѧϰÔÓ̸

1£® ¹ØÓÚ¶¯Ì¬¼ÓÔØ»úÖÆ??
ѧϰJava±ÈC++¸üÈÝÒ×Àí½âOOPµÄ˼Ï룬±Ï¾¹C++»¹»ìºÏÁ˲»ÉÙÃæÏò¹ý³ÌµÄ³É·Ö¡£ºÜ¶àÈ˶¼Äܱ³³öÀ´JavaÓïÑÔµÄÌص㣬ËùνµÄ¶¯Ì¬¼ÓÔØ»úÖƵȵȡ£µ±È»¸ÅÄîÍùÍùÊÇÏȼÇס¶øºóÏû»¯µÄ£¬¿ÉÓжàÉÙÈËÕæÕýÈ¥Ìå»á¹ý¶¯Ì¬¼ÓÔصĻúÖÆ£¬ÊÔͼȥѰÕÒ¹ýÆäÖеÄϸ½ÚÄØ?  Ìṩ´ó¼ÒÒ»¸ö·½·¨£º
ÔÚÃüÁîÐд°¿ÚÔËÐÐJava³ÌÐòµÄÊ ......

javaÊý¾Ý¿âÉè¼ÆÖеÄ14¸ö¼¼ÇÉ

ÏÂÊöÊ®Ëĸö¼¼ÇÉ£¬ÊÇÐí¶àÈËÔÚ´óÁ¿µÄÊý¾Ý¿â·ÖÎöÓëÉè¼Æʵ¼ùÖУ¬Öð²½×ܽá³öÀ´µÄ¡£¶ÔÓÚÕâЩ¾­ÑéµÄÔËÓ㬶ÁÕß²»ÄÜÉú°ïÓ²Ì×£¬ËÀ¼ÇÓ²±³£¬¶øÒªÏû»¯Àí½â£¬ÊµÊÂÇóÊÇ£¬Áé»îÕÆÎÕ¡£²¢Öð²½×öµ½£ºÔÚÓ¦ÓÃÖз¢Õ¹£¬ÔÚ·¢Õ¹ÖÐÓ¦Óá£
      1. ԭʼµ¥¾ÝÓëʵÌåÖ®¼äµÄ¹Øϵ
¡¡¡¡
      ¿ÉÒÔÊÇÒ»¶ÔÒ»¡¢Ò»¶Ô¶à¡¢¶à ......

JavaÖÐÁ¬½ÓÊý¾ÝµÄHibernateÅäÖÃ

JavaÖÐÁ¬½ÓÊý¾ÝµÄHibernate
ÅäÖÃ
hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
 "http://hibernate.s ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ