display array stored from another class.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • red moon

    display array stored from another class.

    hi! i'm taking my first java course. and i'm stuck in this one question. i've tried soo many ways but i still dont know how to do..

    Question:

    1. I've created an object called Lamp.
    2. Then I've created another class (ReadFile) to read the attributes (name, price etc) from a text file (Lamp.txt).
    In this class also, i created four arrays of object lamp.
    e.g: Lamp LampNum = new Lamp [5];
    and i stored all the respective attributes inside the LampNum arrays.
    e.g : LampNum1 = {name, price, etc}
    LampNum2 = {name, price, etc}

    3. Since I have to do a GUI, I need to display to the user the infos I stored in the LampNum arrays but i don't know how to make the GUI class get the LampNum arrays from the ReadFile Class.


    Any help is much appreciated because i'm really2 stuck.
    Thank YOu!
Working...