Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Object class problem (http://www.go4expert.com/forums/object-class-problem-t9024/)

shyam_oec 24Feb2008 22:40

Object class problem
 
Code:

class InstanceTest
{
  public static void main(String [] args)
  {
  InstanceTest ob1=new InstanceTest();
  Object ob2=ob1;
  System.out.println(ob2 instanceof Object);
  System.out.println(ob2 instanceof InstanceTest);
  }
}

I am using jdk1.6
I read this question on a site which tells it's output to be
true
true

But when i tried it on my computer it generated error!!!
can u tell why it happend so,and how to solve it.


All times are GMT +5.5. The time now is 05:43.