This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer (Exam 1Z0-830) Java SE 17 Developer (Exam 1Z0-829) Programmer’s Guide and have Khalid Mughal and Vasily Strelnikov on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to use arraylist from one class into another class + add data in Java

 
Greenhorn
Posts: 22
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

I am very new to Java

what I need to do is like below:

Public Class1
that is an arrayclass that holds multi arrays + lists is my thought.

(In c# I know get and set)

Public Class2

here is where I fill the arrayclass from Class1 with arraydata.

Public Class3

here is where I use the array class1 that reiceved the data in class2 + add more data to the existing array


How do I make this?

basically passing arraylist with data to another class

Thank you in advance


Regards
 
Rancher
Posts: 517
15
Notepad Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you can use three methods in one class, instead of three classes (Class1, Class2 and Class3).

I would like to know little more about your program.

Public Class1
that is an arrayclass that holds multi arrays + lists is my thought.



What kind of arrays and lists are these? Do they have number data or string data or something else?

Public Class2
here is where I fill the arrayclass from Class1 with arraydata.


Can we see some example data?

Also, if you have written any Java code for the mentioned classes (Class1, Class2, Class3) please share with us.
 
Marshal
Posts: 80665
478
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . and welcome to the Ranch
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic