ExamVeda
Login
Home
This question belongs to Java Program Flow Control
Flow Control
?

What will be the result of compiling and running the following code:
public class Test{
      public static void main(String... args) throws Exception{
            Integer i = 34;
            int l = 34;
            if(i.equals(l)){
                  System.out.println("true");
            }else{
                  System.out.println("false");
            }
      }
}

Answer & Solution
Correct Answer: Option A

Equals() method for the integer wrappers will only return true if the two primitive types and the two values are equal.

Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.