Share on Google+Share on Google+

SCJP Module-7 Question-3

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.




Posted on: July 13, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.


Advertisement null