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

 
 

Share on Google+Share on Google+
SCJP Module-7 Question-3
Posted on: July 13, 2010 at 12:00 AM
Advertisement
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)

Advertisement

Related Tags for SCJP Module-7 Question-3:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 13, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com