Results 1 to 5 of 5
  1. #1
    dellacpa is offline Member
    Join Date
    Aug 2010
    Posts
    16
    Rep Power
    0

    Default Assign objects to classes

    Hi, I am creating objects from an excel file that I open and read in a Class A.
    The objects I am creating actually belong to class B.

    How can I assign my objects to class B?

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    What is an "object from an excel file"? Is it an instance of a java class? Or a disk file? or?

  3. #3
    dellacpa is offline Member
    Join Date
    Aug 2010
    Posts
    16
    Rep Power
    0

    Default

    Sorry for my misuse of java language.

    The objects I am creating are instances of class C. So basically class B is composed of class C.
    The objects I am creating are created iin class A.

    So I am trying to write an add-method in class B to add the objects I have created (reading their attributes from the excel table).

    Any help on how the add-method should look like?

    Thanks

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    Not sure what the structure of your app is.
    Sharing data objects between classes is done by passing references to those objects to the code that needs them.

    An add method:
    void add(C aCObject) {
    .. your code here to save ref to C object
    }

  5. #5
    dellacpa is offline Member
    Join Date
    Aug 2010
    Posts
    16
    Rep Power
    0

    Default

    Norm,
    thanks alot for your help. I asked a co-worker and we figured it out.

    Thanks again.

Similar Threads

  1. Accessing objects between classes
    By bikashg in forum New To Java
    Replies: 7
    Last Post: 05-06-2010, 12:05 PM
  2. Classes and Objects Help
    By collin389 in forum New To Java
    Replies: 1
    Last Post: 12-14-2009, 12:44 AM
  3. classes as objects
    By kroiz in forum New To Java
    Replies: 4
    Last Post: 07-25-2009, 05:22 AM
  4. help with passing objects between classes
    By aruna1 in forum New To Java
    Replies: 7
    Last Post: 03-22-2009, 02:41 PM
  5. Objects and Classes
    By Aleve in forum New To Java
    Replies: 8
    Last Post: 12-31-2007, 08:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •