Results 1 to 3 of 3
  1. #1
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default arrays and/ are objects

    Have been away from JAVA over four years (wow, how did our world change), and picking up programming again!
    I have lost some understanding of things and here is my small problem…
    Here is the actual situation:
    -there are 3 classes A,B and C
    -class B declares an array:
    1) int[] xpt; // in the header of the class;
    2) xpt = new int[7]; // at the constructor of that class;
    3) class A initiates an object of class B and the arrays gets filled by mouse clicks (works fine);
    4) When I want to get hold of that array in class C, what do I do….

    Initiating (another) object of class B (in C) the array class will call the constructor and "delete" the values of the "original" array…..

    What a mess?

    thanks for any help (any of the old folks still around?)

    BTW all classes are in the same packet and the first class is actually an applet (that works up to here)
    again what a mess!

  2. #2
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: arrays and/ are objects

    Need to add this to it:
    next step is that I have to have the array data also in class C

  3. #3
    ieee488 is offline Member
    Join Date
    Dec 2012
    Posts
    12
    Rep Power
    0

    Default Re: arrays and/ are objects

    How are A, B, and C related?

    If you want class C to be able to access the array data in class B, just create a public method in class B.

Similar Threads

  1. GUI, Arrays, Objects, and Components
    By jazob in forum New To Java
    Replies: 6
    Last Post: 01-19-2012, 12:25 AM
  2. Arrays of Objects
    By superscout in forum New To Java
    Replies: 2
    Last Post: 01-15-2012, 03:16 PM
  3. How to use class objects in arrays
    By dironic88 in forum Eclipse
    Replies: 6
    Last Post: 04-06-2011, 02:34 PM
  4. scanner objects with arrays again..
    By nevermiind in forum New To Java
    Replies: 18
    Last Post: 05-24-2010, 12:45 PM
  5. Objects and Arrays
    By bannow in forum New To Java
    Replies: 3
    Last Post: 04-19-2010, 08:15 PM

Posting Permissions

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