javaÖÐequalsºÍ==µÄÇø±ð
ÖµÀàÐÍÊÇ´æ´¢ÔÚÄÚ´æÖеĶÑÕ»£¨ÒÔºó¼ò³ÆÕ»£©£¬¶øÒýÓÃÀàÐ͵ıäÁ¿ÔÚÕ»Öнö½öÊÇ´æ´¢ÒýÓÃÀàÐͱäÁ¿µÄµØÖ·£¬¶øÆä±¾ÉíÔò´æ´¢ÔÚ¶ÑÖС£
==²Ù×÷±È½ÏµÄÊÇÁ½¸ö±äÁ¿µÄÖµÊÇ·ñÏàµÈ£¬¶ÔÓÚÒýÓÃÐͱäÁ¿±íʾµÄÊÇÁ½¸ö±äÁ¿ÔÚ¶ÑÖд洢µÄµØÖ·ÊÇ·ñÏàͬ£¬¼´Õ»ÖеÄÄÚÈÝÊÇ·ñÏàͬ¡£
equals²Ù×÷±íʾµÄÁ½¸ö±äÁ¿ÊÇ·ñÊǶÔͬһ¸ö¶ÔÏóµÄÒýÓ㬼´¶ÑÖеÄÄÚÈÝÊÇ·ñÏàͬ¡£
==±È½ÏµÄÊÇ2¸ö¶ÔÏóµÄµØÖ·£¬¶øequals±È½ÏµÄÊÇ2¸ö¶ÔÏóµÄÄÚÈÝ¡£
ÏÔÈ»£¬µ±equalsΪtrueʱ£¬==²»Ò»¶¨Îªtrue£»
Ò»¡¢StringÖеÄequalsºÍ==
1¡¢
public class TestString {
public static void main(String[] args) {
String s1 = "Monday";
String s2 = "Monday";
}
}
ÉÏÃæÕâ¶Î³ÌÐòÖУ¬µ½µ×Óм¸¸ö¶ÔÏóÄØ£¿
À´¼ì²âһϰɣ¬ÉÔ΢¸Ä¶¯Ò»Ï³ÌÐò
public class TestString {
public static void main(String[] args) {
String s1 = "Monday";
String s2 = "Monday";
if (s1 == s2)
System.out.println("s1 == s2");
else
System.out.println("s1 != s2");
}
}
±àÒë²¢ÔËÐгÌÐò£¬Êä³ö£ºs1 == s2
˵Ã÷£ºs1 Óë s2 ÒýÓÃͬһ¸ö String ¶ÔÏó -- "Monday"!
2.
ÔÙÉÔ΢¸Ä¶¯Ò»Ï³ÌÐò£¬»áÓиüÆæ¹ÖµÄ·¢ÏÖ£º
public class TestString {
public static void main(String[] args) {
String s1 = "Monday";
String s2 = new String("Monday");
if (s1 == s2)
System.out.println("s1 == s2");
else
&nb
Ïà¹ØÎĵµ£º
mysqlÊý¾Ý¿â±¾ÉíÓÐÊý¾Ý±¸·ÝºÍÅúÁ¿Êý¾Ý²åÈëµÄÃüÁjava´úÂë¿ÉÖ´ÐÐÕâЩÃüÁî¡£
°²×°mysqlºó£¬ÐèÒªÉèÖû·¾³±äÁ¿£ºÎҵĵçÄÔÓÒ»÷--ÊôÐÔ--¸ß¼¶--»·¾³±äÁ¿£¬Ôö¼ÓMYSQL_HOME=“mysql°²×°Â·¾¶”£¬È»ºópath=%MYSQL_HOME%\bin
´úÂëÈçÏ£º
import java.io.BufferedReader;
import java.io.FileInputStream;
import java. ......
¸ø¶¨ÓÉn¸öÕûÊý×é³ÉµÄÐòÁÐ(a1, a2, …, an)£¬Çó¸ÃÐòÁеÄ×Ӷκ͵Ä×î´óÖµ£¬µ±ËùÓÐÕûÊý¾ùΪ¸ºÕûÊýʱ£¬Æä×î´ó×ӶκÍΪ0¡£
LargestSubsegmentSum1.java //ÂùÁ¦Ëã·¨
import ......
1¡¢super(²ÎÊý)£ºµ÷ÓûùÓÚ¸¸ÀàµÄijһ¸ö¹¹Ô캯Êý£¨Ó¦¸ÃΪ¹¹Ô캯ÊýµÄµÚÒ»ÌõÓï¾ä£©£»
2¡¢this(²ÎÊý)£ºµ÷ÓÃͬһ¸öÀàÖÐÆäËûµÄ¹¹Ô캯Êý£¨Ó¦¸ÃΪ¹¹Ô캯ÊýµÄµÚÒ»ÌõÓï¾ä£©¡£
3¡¢super£ºËüÒýÓõ±Ç°Ö±½Ó¸¸ÀàÖеijÉÔ±£¨ÓÃÓÚ·ÃÎʵ±Ç°Ö±½Ó¸¸ÀàÖб»Òþ²ØµÄ¸¸ÀàÖеÄÊý¾Ý»ò·½·¨£¬¸¸ÀàÓë×ÓÀàÖÐÓÐÏàͬµÄ³ÉÔ±¶¨Ò壩
  ......
ÓиÐ:ӦƸJava±ÊÊÔʱ¿ÉÄܳöÏÖÎÊÌâ¼°Æä´ð°¸
ǰ¶Îʱ¼äÒòΪҪ²Î¼ÓÒ»¸ö±ÊÊÔ£¬ÔÚ×¼±¸ÆÚ¼äÔÚÍøÉÏÕÒµ½ÁËÁ½Ìõ¹ØÓÚ±ÊÊÔÌâÄ¿µÄÎÄÕ£¬ÆäÖÐһƪΪ<<ÓиÐ:ӦƸJava±ÊÊÔʱ¿ÉÄܳöÏÖÎÊÌâ>>£¬»¹ÓÐһƪÍüÁËÃû×Ö£¬¶ÁºóÉîÊÜÆô·¢¡£
ÔÚѰÕÒÕâЩ´ð°¸µÄ¹ý³ÌÖУ¬ÎÒ½«Ïà¹Ø´ð°¸¼Ç¼ÏÂÀ´£¬¾ÍÐγÉÁËÒÔÏÂÕâЩ¶«Î÷¡£ÐèҪ˵à ......
ÒÔÏÂÊÇʵÏÖ¹ý³Ì£¬½ö¹©²Î¿¼:
JAVA_HOMEÊÇ C:\jdk1.6.0_02
PathÊÇ %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
CLASSPATHÊÇ .;%JAVA_HOME%lib;%JAVA_HOME%lib\tools.jar
ÓÃ Java
ͨ¹ý´®¿Ú·¢¶ÌÐÅÆäʵºÜ¼òµ¥£¬ÒòΪÓÐÏֳɵÄÀà¿â¹©ÎÒÃÇʹÓá£ÓеײãµÄÀà¿â£¬Ò²Óзâ×°ºÃÒ»µãµÄÀà¿â£¬ÏÂÃæÎÒ½éÉÜÒ»ÏÂÔÚ Win32 ƽ̨Ï·¢ËͶÌÐŵķ½·¨¡£
......