What will be the output?
public class Test{
public static void main(String args[]){
System.out.print(""=="");
System.out.print(" ");
System.out.print("A"=="A");
System.out.print(" ");
System.out.print("a==A");
}
}
public class Test{
public static void main(String args[]){
System.out.print(""=="");
System.out.print(" ");
System.out.print("A"=="A");
System.out.print(" ");
System.out.print("a==A");
}
}
A. "==" A"=="A a==A
B. true true false
C. true true a==A
D. Compilation Fails
E. None of the above
Answer: Option C
Join The Discussion
Comments ( 4 )
Related Questions on Operators
First print statement gives the value true as it is checking the equality.
Second print statement gives the value true as it is also checking the equality.
Third print statement gives the value a==A since they are enclosed in double quotes.
Hence, Option (C) is the correct one.
Anishabrata Dutta you are quite wrong because
(" "==" ") means null == null ,so true
(" "==" ") means space == space ,so true
("A"=="A") means A == A , so true
("a==A") only two "s are there so we are not comparing anything here..it is a string
Can anyone explain the output?