&のオンラインビデオのいくつかを検索したが、適切ではないことがわかったときに、のJavaで&のプログラムを作成しました説明。だから、みんなが私にそれを手伝ってくれる。クラスコンストラクターが作成され、単純な文字列を比較したときの等価()
ありがとうございました。
package Practice;
public class StringManipulation11 {
StringManipulation11(String s) {
}
public static void main(String[] args) {
String s = "Good";
String s1 = "Good";
String s2 = "Morning";
String t = new String("Good");
String t1 = new String("Good");
String t2 = new String("Morning");
StringManipulation11 sm = new StringManipulation11("Good");
StringManipulation11 sm1 = new StringManipulation11("Good");
System.out.println(s.equals(s1));// true because check content
System.out.println(s.equals(s2));// false content not match
System.out.println(t.equals(t1));// true because check content
System.out.println(s.equals(t));// true because check content
System.out.println(sm.equals(sm1));// false, but not getting the reason
// why it is false
/*
* In this case also the content is same but not getting the proper
* conclusion why it is false & it is false then why i am getting true
* in "System.out.println(t.equals(t1))" in this condtion.
*/
System.out.println(s.equals(sm));
}
}
普通の言葉でそれを置くために – Shaun
ただ、クラスの仲間 – Ash
だん内容を確認する必要があります。 あなたはそれが2つのオブジェクトを比較するとき、「等しい」ことを意味するものと述べたことはありません。 – Shaun