Passing objects (not stones)

From: NotAsDumbAsILook (toyota_trekker_at_yahoo.com)
Date: 02/25/04


Date: 25 Feb 2004 12:10:52 -0800

I'm using NetBeans 3.5.1. Why doesn't this work?

Referenced class:

public class MyClass {

   ...
   ...
   
   // All sorts of methods in here that work

   ...
   ...

   
    public Object objectForValue(int i) {
        // test code
        Object o = "objectForValue";
        return o;
    }
}

Here's where the error is:

public class MyOtherClass {

   ...
   ...
   
   // All sorts of methods in here that work

   ...
   ...

    public Object getObjectTest(int i) {
        // test code
        MyClass mine = new MyClass();
        Object o = mine.objectForValue(i); <<== ERROR
        return o;
    }

}

The error I get is:

myTestModel.java [40:1] cannot resolve symbol
symbol : method objectForValue (int)
location: class MPNode
            Object o = mine.objectForValue(i);

I intially just had the getObjectTest method as:

    public Object getObjectTest(int i) {
        MyClass mine = new MyClass();
        return mine.objectForValue(i);
    }

but that didn't work either. It gave the same error.

Apparently there is something about the Object class that I don't
understand. Could someone enlighten me?



Relevant Pages

  • Re: question relates to instance variable initialization
    ... I am unclear about the following two ways to initialize instance ... public class MyClass ...
    (comp.lang.java.programmer)
  • Re: XML Serializer
    ... CDATA to escape special characters, ... semantically, the meaning of XML remains exactly the same, and, unless ... public class MyClass ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Initializing variable style question
    ... public class MyClass ...     public MyClass ... To initialize to a non-zero-like value, ...
    (comp.lang.java.programmer)
  • access to static public nested classes
    ... In the Java compiler 1.4 this works but I get a compile time error ... public class Contain { ... UClass.java:12: cannot resolve symbol ...
    (comp.lang.java.programmer)
  • RE: How to reference function in shared function?
    ... Public Class Class1 ... > Public Class myClass ... > shared member initializer without an explicit instance of the class. ... > I also tried this below the class declaration: ...
    (microsoft.public.dotnet.languages.vb)