Search:

Type: Posts; User: Norm

Search: Search took 0.19 seconds.

  1. Replies
    12
    Views
    2,452

    Re: calling objects in a differnt class

    obj[0]=new di(22); ---------------------> from here

    That line of code must be in a method.
  2. Replies
    12
    Views
    2,452

    Re: calling objects in a differnt class

    How are you compiling your program? The output you posted looks like an execution trace, not something from the javac command.

    Your code must have some serious syntax errors. Look at the lines...
  3. Replies
    12
    Views
    2,452

    Re: calling objects in a differnt class

    Please copy and paste here the output from when you execute the program.
    Do you get errors? Copy and paste the full text here.

    Please use code tags around your code when posting. See: BB Code...
  4. Replies
    12
    Views
    2,452

    Re: calling objects in a differnt class

    How will class C get the reference?
    Does class C have a reference to the class B object?
    If it does, it can call a method in class B to get to the obj variable. For example:
    have a method in...
  5. Replies
    12
    Views
    2,452

    Re: calling objects in a differnt class

    AnObject anObjReference = new AnObject();

    anObjReference is a reference to an object.
Results 1 to 5 of 5