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

javaÖÐ== ÓëequalsµÄÇø±ð

public class test1
{
 public static void main(String[] args){
  //== ÓëequalsµÄÇø±ð
  //1.nullµÄ±È½Ï£ºÖ»ÄÜÓÃ==
  System.out.println("1.nullµÄ±È½Ï£ºÖ»ÄÜÓÃ==");
  Object o1=null,o2=null;
  System.out.println(null==null&&o1==null&&o1==o2);//true
        //System.out.println(o1.equals(o2)) //Å׳öÒì³£
         
  //2.»ù±¾ÀàÐ͵ıȽϣºÖ»ÄÜÓÃ==
  System.out.println("\n\n2.»ù±¾ÀàÐ͵ıȽϣºÖ»ÄÜÓÃ==");
  double i=2.4,j=2.4;
  System.out.println(i==j);//true
  
  
  //3.ÒýÓõıȽϣºµ±×ÓÀàÖØд¹ýequalsÖ®ºó£¬ ==ÓëequalsµÄ±È½ÏЧ¹û²¢²»Í¬£¬e.g  String
  //==Ï൱ÓÚ×îԭʼµÄequals
  /*¸ùÀàObjectÓÐÈçÏ´úÂë
   * public boolean equals(Object obj) {
   * return (this == obj);
      * }
   * */
  System.out.println("\n\n3.ÒýÓõıȽϣº" +
    "µ±×ÓÀàÖØд¹ýequalsÖ®ºó£¬ ==ÓëequalsµÄ±È½ÏЧ¹û²¢²»Í¬£¬e.g  String");
  String str1=new String("string"),str2=new String("string"),str3=str1;
  System.out.println(str3==str1&&str3.equals(str1));//Ö¸Ïòͬһ¶ÔÏó£¬true
  System.out.println(str1==str2);//²¢²»Ö¸Ïòͬһ¸ö¶ÔÏó£¬false
  System.out.println(str1.equals(str2));//ÓÉÓÚequals±»ÖØдÁË£¬
  //Ö»±È½Ï ËûÃǵÄÖµ£¬ËùÒÔ±¾Àý·µ»Øtrue
  
  //4.×¢ÒâµÄµØ·½,new String() ÓëÖØÔØ·ûºÅ=µÄÇø±ð
  System.out.println("\n\n4.×¢ÒâµÄµØ·½,new String() ÓëÖØÔØ·ûºÅ=µÄÇø±ð");
  System.out.println("string"=="string");//·µ»Øtrue,˵Ã÷Ö¸ÏòµÄÊÇͬһ¸ö¶ÔÏó
  System.out.println(new String("string")=="string");//·µ»Øfalse
  
  
 }
}


Ïà¹ØÎĵµ£º

java ÃæÊÔÌâ59µÀ£¨º¬²Î¿¼´ð°¸£©


Java
»ù´¡·½Ãæ
:
 
1
¡¢×÷ÓÃÓò
public,private,protected,
ÒÔ¼°²»Ð´Ê±µÄÇø±ð
´ð£º
Çø±ðÈçÏ£º
×÷ÓÃÓò
           
µ±Ç°Àà
       
ͬһ
package  
×ÓËïÀà
     &n ......

C++ºÍJava ÄĸöºÃ£¿ £¨Ô´×Ô Æ滢fvfve£©

JAVA¿ÉÒÔ˵ÊÇ´ÓC++·¢Õ¹ÆðÀ´µÄÍêÈ«ÃæÏò¶ÔÏóµÄ¿ª·¢ÓïÑÔ,Á½ÕßµÄʵÖÊÇø±ðÊÇÀûÒæ·ÖÊô²»Í¬µÄ¹«Ë¾:SUNºÍ΢Èí.¶Ô´Ë΢Èí·¢²¼ÁË.NETÓëÖ®¿¹ºâ.
´Ó×îеÄVisual Studio .NET 2005¿´,.NETÖ÷ÒªÊÇ4ÖÖÓïÑÔ:VB.NET, C#, C++.NET, J#.
VB.NET¿ÉÒÔ˵ÊÇVB6µÄÉý¼¶,µ«ÎÒÈÏΪVB.NETºÍC#ÒѾ­ÊÇÍêȫȫеÄÓïÑÔÁË,Á½ÕßµÄÄ¿µÄ¶¼ÊÇÒª´ò°ÜJAVAÕâ¸ö¾ºÕù¶ ......

Java Ïà¹ØÄÚÈÝÔÓ¼Ç

1¡¢Eclipse µÄÆô¶¯»­Ãæ
   A¡¢¼ÓÆô¶¯²ÎÊý¡£È磺 eclipse.exe -showsplash C:\splash.bmp
        ¸ü¶à¿É²Î¿¼£ºhttp://www.cnblogs.com/sharewind/archive/2007/03/11/671270.html
   B¡¢ÐÞ¸ÄĬÈÏͼƬ¡£Î»ÓÚ£ºplugins\org.eclipse.platform_3.3.2.R33x_v20071022 ......

Java ÕýÔò±í´ïʽ ×Ö·û´®Æ¥Åä

import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class JavaBasic {
     public static void main(String[] args){
      StringBuffer sd = new StringBuffer();
      String hhhString="adlkll";
    &nbs ......

javaÖйؼü×ÖvolatileµÄ×÷ÓÃ

ÓÃÔÚ¶àỊ̈߳¬Í¬²½±äÁ¿¡£ Ïß³ÌΪÁËÌá¸ßЧÂÊ£¬½«Ä³³ÉÔ±±äÁ¿(ÈçA)¿½±´ÁËÒ»·Ý£¨ÈçB£©£¬Ïß³ÌÖжÔAµÄ·ÃÎÊÆäʵ·ÃÎʵÄÊÇB¡£Ö»ÔÚijЩ¶¯×÷ʱ²Å½øÐÐAºÍBµÄͬ²½¡£Òò´Ë´æÔÚAºÍB²»Ò»ÖµÄÇé¿ö¡£volatile¾ÍÊÇÓÃÀ´±ÜÃâÕâÖÖÇé¿öµÄ¡£volatile¸æËßjvm£¬ ËüËùÐÞÊεıäÁ¿²»±£Áô¿½±´£¬Ö±½Ó·ÃÎÊÖ÷ÄÚ´æÖеģ¨Ò²¾ÍÊÇÉÏÃæ˵µÄA)
===================== ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ