Home Tutorial Java Scjp Part7 SCJP Module-7 Question-3

 
 

SCJP Module-7 Question-3
Posted on: July 13, 2010 at 12:00 AM
This program tests your understanding about the Number class and the int data type in Java.

Given a sample code:

1    public class Test {
2    public static void main(String[] args) {
3    Number i=10;
4    int j = 10;
5    if (i.equals(j))
6    {
7    System.out.println("equals");
8    }
9    else
10  System.out.println("not equals");
}
}

What will be the result of above code ?

(1) not equal
(2) equal
(3) Compile time error at line no 3.
(4) Compile time error at line no 5.

Answer:

(2)

Related Tags for SCJP Module-7 Question-3:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.