Return to site

JAVA CERTIFICATION QUESTION: The plus + and equals-equals == operators in Java

· java

These common Java operators work differently with numeric and string operands.

Given the class👇👇👇

public class StringComparison {
  public static void main(String[] args) {
    var str1 = "Java 11";
    var str2 = "Java 11";
    var res = "The" + " " + "same:" + str1 == str2;
    System.out.print(res);
  }
}

 

🤔 What is the output? Choose one.

A. The same:true

B. The same:false

C. true

D. false

 

 

 

 

 

 

·ꓷ uoᴉʇdo sᴉ ɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥꓕ ·uoᴉsnʅɔuoꓛ