パブリッククラスのテストをMEEするために教えてください{//名前 "テスト"このコードの出力は何ですか、なぜですか?
static public void main(String[] args)
{
Long a=111L; //declaring Long type variable
Long b=111L; //declaring Long type variable
Long c=222L; //declaring Long type variable
Long d=222L; //declaring Long type variable
System.out.println((a==b)+" "+(c==d)); /*output is "true false". I dont know Why? Please explain */
}
と宣言クラス}
あなたはオブジェクトを比較する方法ではない、ということはご存知でしょうか? –
具体的な質問がありますか?混乱する箇所はありますか?コード自体は非常に基本的なものであり、いくつかのオブジェクトを比較し、比較結果を出力します。 – Zabuza
[.equals()と==演算子で2つのオブジェクトを比較する](https://stackoverflow.com/questions/13387742/compare-two-objects-with-equals-and-operator) – jmoerdyk