,* Because the Equals method of object is compared with the double equals sign (= =), the result of the comparison is the same as the double equals sign (= =).**/Method_1 compile run result is S1==S2Description: S1 and S2 refer to the same Sring object---"Monday"public static void Method_1 () {String S1 = "Monday";String s2 = "Monday";if (S1==S2) {System.out.prin
object is compared with the double equals sign (= =). So the result of the comparison is the same as the double equals sign (= =).1Public Classteststring {2 Public Static voidMain (string[] args) {3String S1= "Monday";4String S2= "Monday";5If(S1== S2) 6 { 7 Span style= "color: #000000;" >system.out.println ( "S1 = = S2 ");} 8 else{ 9 system.out.println ( "s1! = S2" );} 10 11 } compile and run the
overwritten, such as String, Integer, and Date. Among these classes, equals has its own implementation, instead of the storage address of the comparison class in the heap memory.For equals comparison between composite data types, if the equals method is not overwritten, the comparison between them is based on the address value of their storage location in the memory, because the equals method of the Object is compared with the binary equal sign (=), the comparison result is the same as that of
method is not covered, because the Equals method of object is compared with the double equals sign (= =). So the result of the comparison is the same as the double equals sign (= =).1 Publicclassteststring {2 PublicStaticvoidMain (string[] args) {3 String S1="Monday";4 String S2="Monday";5 if(S1==S2)6 {7 System.out.println ("S1 = = S2");}8 Else{9 System.out.println ("S1! = S2");}Ten } One }Compile and ru
compared with the double equals sign (= =). So the result of the comparison is the same as the double equals sign (= =).1 public class TestString {2 public static void Main (string[] args) {3 String S1 = "Monday";4 String s2 = "Monday";5 if (S1 = = s2)6 {7 System.out.println ("S1 = = S2");}8 else{9 System.out.println ("S1! = s2");}10}11}Compile and run the program, output: S1 = = S2 Description: S1 and S2
(Class)When they compare with (= =), they compare the storage address in memory, so unless it is the same new object, their comparison result is true, otherwise the result is false. All classes in Java are inherited from the base class of object, and a method of equals is defined in the base class in object, and the initial behavior of this method is to compare the memory address of the object, but in some class libraries This method is overwritten, such as String,integer, In these classes, dat
, and a method of equals is defined in the base class of object, and the initial behavior of this method is to compare the memory address of the object, but in some class libraries This method is overwritten, such as String, Integer,date in these classes equals has its own implementation, and is no longer a comparison class in the heap memory of the storage address. For the equals comparison between composite data types, the comparison between them is based on the address value of the location i
object is compared with the double equals sign (= =). So the result of the comparison is the same as the double equals sign (= =). 1Public Classteststring {2 Public Static voidMain (string[] args) {3String S1= "Monday";4String S2= "Monday";5If(S1== S2) 6 { 7 system.out.println ( "S1 = = S2" );} 8 else{ 9 system.out.println ( "s1! = S2" );} 10 11 } Compile and run the program, output: S1 = = S2 Descrip
is not covered, because the Equals method of object is compared with the double equals sign (= =). So the result of the comparison is the same as the double equals sign (= =).1Public Classteststring {2Public Static voidMain (string[] args) {3String S1= "Monday";4String S2= "Monday";5If(S1== S2) 6 { 7 Span style= "color: #000000;" >system.out.println ( "S1 = = S2 ");} 8 else{ 9 system.out.println (
is based on the address value of their storage location in the memory, because the equals method of the Object is compared with the binary equal sign (=), the comparison result is the same as that of the binary equal sign (=.
publicclass TestString { publicstaticvoid main(String[] args) { String s1 ="Monday"; String s2 ="Monday"; if (s1 == s2) { System.out.println("s1 == s2");} else{ System.out.pri
compared with the double equals sign (= =). So the result of the comparison is the same as the double equals sign (= =).1 public class TestString {2 public static void Main (string[] args) {3 String S1 = "Monday";4 String s2 = "Monday";5 if (S1 = = s2)4 97 System.out.println ("S1 = = S2");}8 else{9 System.out.println ("S1! = s2");}10}11}Compile and run the program, output: S1 = = S2 Description: S1 and S2
is based on the address value of their storage location in the memory, because the equals method of the Object is compared with the binary equal sign (=), the comparison result is the same as that of the binary equal sign (=.
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
between them is based on the address value of their storage location in the memory, because the equals method of the Object is compared with the binary equal sign (=), the comparison result is the same as that of the binary equal sign (=.
public class TestString { public static void main(String[] args) { String s1 = "Monday"; String s2 = "Monday"; if (s1 == s2) { System.out.println("s1 == s2");}
memory where the Equals method is not covered, because the Equals method of object is compared with the double equals sign (= =). So the result of the comparison is the same as the double equals sign (= =).1 public class TestString {2 public static void Main (string[] args) {3 String S1 = "Monday";4 String s2 = "Monday";5 if (S1 = = s2)6 {7 System.out.println ("S1 = = S2");}8 else{9 System.out.println ("S1
object is also compared with the double equal sign (= =). So the result of the comparison is the same as the result of the double equal sign (= =).
Copy Code code as follows:
Publicclass teststring {
Publicstaticvoid Main (string[] args) {
String S1 = "Monday";
String s2 = "Monday";
if (S1 = = s2)
{
System.out.println ("S1 = = S2");}
else{
System.out.println ("S1!= S2");}
}
place to start.
31. People are good, while blessings are not yet, they are far from suffering. People are evil, and happiness is far from suffering from evil.
32. If you do not do anything, you will be safe. If you do not do anything, you will be safe.
33. Those who do not respect themselves should be insulted. The elders are not the elders. Benefit from being complacent. Not self-satisfied.
34. If the fund is left for future generations, the childre
cool moonlight becomes warm. Think of the stubborn man, and she smiled: My heart is a desert, and how can the water be wet?
Sang thought the man would be completely dead, but she was wrong. He will still invite sang to his favorite place to drink her favorite tea, but he will not send roses any more.
When Sang misses a person who insists on being alone, he also insists on being alone in love with Sang.
In fact, he is a good man. It is easy to find a good girl as a wife. Sang sometimes advised h
both talented and beautiful. They are a perfect match of Heaven and Earth.
* At this time, the new service staff of your primary store may ask you to sit in first, and then wait until the host of the National People's Congress opens an appointment to cover your primary family, after parents wait for background or interesting things, the host can say: Now we invite new people to come on stage.
* When you come to the stage, you will usually be notified by the host, or you can use an interview t
A lot of work has been organized and completed in the past two days. This is my requirement.
Didn't a foreigner say this was "starting on March "?
I went to the hospital with my wife in the afternoon. The problem was a little serious. I bought some very expensive medicines and had a baby insurance. Is it too late for me to work every day?
I went to Unicom tomorrow morning to send the invoice. I just looked at the previous logs and found that my personality is not epiphany, but gradually reali
Wealth". This is a brand new mobile game with the same name. With the music of God of Wealth, in the Spring dynasty, on the path of the mountains, in the colorful fireworks, chase the footsteps of God of Wealth and receive the blessings of God of Wealth! God of Wealth has arrived in the world. Do not miss it!Official Address:Http://www.otlive.cn/html/mobile/app/FortuneKing2/iphone_cn.shtmlIOS version:Http://itunes.apple.com/cn/app/fortune-king-2/id49
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.