Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Not Able to getInstanceOf Object

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Not Able to getInstanceOf Object

    Default Not Able to getInstanceOf Object

    Hi guys,

    I am trying identify whether particular object is an instance of the Object,I am using this in the blackberry java application,I am using Eclipse IDE,Even though Object shows it as RenderDetails,But it is not getting under the condition of instanceof Operation,

    com.app.MyObjectDetails@db8a08fa--getting this as Eclipse debugging

    if i check as

    if (Object instanceof MyObjectDetails)
    S.o.p("MyObject")---->i am not getting here


    Any Ideas what could be the problem,?

    Regards
    Rakesh shankar.P


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Not Able to getInstanceOf Object

    Your MyObjectDetails class does not override the toString method of Object.
    Improving the world one idiot at a time!

  3. #3
    Junior Member
    Join Date
    Jul 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Not Able to getInstanceOf Object

    So,What could be done,I dont understand it,How should i overcome it.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Not Able to getInstanceOf Object

    Could you write a small pgm that compiles and executes to demo the problem?

    Naming a variable with the same name as a java class is confusing: Object.

  5. #5
    Junior Member
    Join Date
    Jul 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Not Able to getInstanceOf Object

    Hi,I cannot directly replicate that issue,If I am checking the instanceOf scrollField (OtherFieldwhich is an Object),it is working perfectly.


    ScreenField--It is a sort of Form(basically a manager,Like a JFrame) which is added to some other Manager,which instance is creating a problem.


    class ScreenField extends Manager{

    ScreenField(Manager mgr)
    {
    VerticalfieldManager vfm=new VerticalFieldManager();
    vfm.add(add new LabelField("test");
    this.add(vfm);
    mgr.add(this);
    }



    }
    Since ScreenField contains some other manager,that could be reason of the error?

    Regards
    Rakesh shankar.P

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Not Able to getInstanceOf Object

    could be reason of the error?
    \
    Hard to say what the problem is without a SSCCE.

Similar Threads

  1. Calling from one javabean object to other javabean object in a single class
    By kichkich in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 24th, 2011, 07:20 AM
  2. Reading from ResultSet to Object and from object Object Array
    By anmaston in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 7th, 2011, 06:11 AM
  3. 2D Object makes my object smaller, Why?
    By MassiveResponse in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 15th, 2010, 02:33 PM
  4. Help with object
    By Spangle1187 in forum Collections and Generics
    Replies: 3
    Last Post: April 22nd, 2010, 04:34 PM
  5. Object o = new Object(); need help
    By zeeshanmirza in forum Object Oriented Programming
    Replies: 11
    Last Post: January 6th, 2010, 10:01 PM