Object class problem

Discussion in 'Java' started by shyam_oec, Feb 24, 2008.

  1. shyam_oec

    shyam_oec New Member

    Joined:
    Nov 26, 2007
    Messages:
    89
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Software Developer, .NET Framework
    Location:
    Jamshedpur
    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.
     
    Last edited by a moderator: Feb 25, 2008

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice