Results 1 to 6 of 6

Thread: getObject() method not working

  1. #1
    Join Date
    Dec 2009
    Posts
    263

    getObject() method not working

    Hello,
    I think I have a problem with the getObject() method in java.
    Here is my code, please check it and if you find any problems then please guide me with the correct.
    Code:
    Public class sub extends Element
    {
    	Public sub (String nm, String des)
    	{
    		great(nm, des);
    	}
    	
    	Public String getName()
    	{
    		return great.nm;
    	}
    }
    I try this with my code, but it is not working
    Code:
    Object obj = Player.getObjet("Diamond");
    System.out.System.out.println(obj.getName());
    System.out.System.out.println(obj.getDescription());
    Any help on this is appreciated. Thanks in advance.

  2. #2
    Join Date
    Nov 2009
    Posts
    347

    Re: getObject() method not working

    Hello,
    You can try the following code,
    Code:
    for (int i = 0; i <this.sac.size (); i + +)
        (
        Object obj = (Object) this.sac.get (i);
        / / If the object is then asked to give
        System.out.println (nobj.getNom () + "" + objectName);
        if (nobj.equals (nobj.getNom ())) / / remove;
        			(
        return nObject;
        )
        )
        return null;
    )

  3. #3
    Join Date
    Nov 2009
    Posts
    359

    Re: getObject() method not working

    Hello,
    I have not read all the code but I think it's just great to getName, this is how you can do this
    Code:
    Public String getName()
    	{
    		return great().name;
    	}
    you have a problem in getObj because you called getName. I guess I am correct here. I hope this syntax will help you and you will start with your code and successfully program it.

  4. #4
    Join Date
    Nov 2009
    Posts
    330

    Re: getObject() method not working

    Hello,
    super () is a method that calls the constructor of the superclass. I'm not sure we can use that. super () reference Does the parent object in question? I'm not sure. But if, as a method, it is called the form of super (). If you want more information on this then you can visit the sun's official site and there you can find all the necessary information that you require regarding the super() keyword.

  5. #5
    Join Date
    Nov 2009
    Posts
    518

    Re: getObject() method not working

    Hello,
    I think using the super() keyword you can do it, that is what exactly you need it in your code, super () returns the parent object, then an attribute of the parent object is called.
    Here is the sample code
    Code:
    Public String getName()
    	{
    		return great().name;
    	}
    If you need any more information regarding this topic then please do post back and we will try to solve it.

  6. #6
    Join Date
    Nov 2009
    Posts
    446

    Re: getObject() method not working

    Hello,
    See the following part of the code
    Code:
    if (obj.equals(aobj.getName())) / / remove;
        			{
        			return aobj;
        			}
    In the above the comments are before the semicolon which makes unreachable return statement, we must remove them or you will get and exception when you will try to compile the program.

Similar Threads

  1. Right-click scan method is not working in Ad-Aware 9.x
    By Sunny.Leoness in forum Networking & Security
    Replies: 7
    Last Post: 27-11-2011, 03:59 PM
  2. Replies: 4
    Last Post: 24-01-2011, 03:40 PM
  3. Collections.sort method not working
    By ISAIAH in forum Software Development
    Replies: 5
    Last Post: 11-02-2010, 03:27 AM
  4. Microsoft VBScript runtime error: Permission denied: 'GetObject'
    By Swati_here_2008 in forum Software Development
    Replies: 3
    Last Post: 05-05-2008, 01:57 PM
  5. Replies: 3
    Last Post: 08-03-2006, 02:41 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,900,966.18981 seconds with 17 queries