Examveda
Examveda

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");

      }

}

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


This Question Belongs to Java Program >> Operators

Join The Discussion

Comments ( 4 )

  1. Chaitanya Singh
    Chaitanya Singh :
    3 years ago

    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.

  2. Anonymous XYZ
    Anonymous XYZ :
    6 years ago

    Anishabrata Dutta you are quite wrong because
    (" "==" ") means null == null ,so true

  3. Anishabrata Dutta
    Anishabrata Dutta :
    7 years ago

    (" "==" ") 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

  4. John Alfred
    John Alfred :
    7 years ago

    Can anyone explain the output?

Related Questions on Operators