Use ArrayList in java! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Use ArrayList in java!

(Use ArrayList)Write a program that creates an ArrayList and add a loan object, a Date object, a String and a Circle object to the list, and use a loop to display all the elements in the list by invoking the object's toString() method .

27th Jun 2020, 7:51 AM
@Danish🇦🇫
@Danish🇦🇫 - avatar
8 Answers
+ 3
Try this: //Create an ArrayList ArrayList<Object> list = new ArrayList<Object>(); //You have to create these classes.. list.add(new Loan()); list.add(new Date()); list.add(new String()); list.add(new Circle()); //And print.. for (Object obj : list) System.out.println(obj.toString());
27th Jun 2020, 8:07 AM
Blue!!
Blue!! - avatar
+ 2
great! it is ok! thanks
27th Jun 2020, 8:30 AM
Noria Soltani
Noria Soltani - avatar
+ 2
این سوال مربوط من هم بود 😂😂
6th Jul 2020, 12:06 PM
‎Maryam Makhdoom
‎Maryam Makhdoom - avatar
+ 1
it is a good way to slove our problem😁😁😁
6th Jul 2020, 12:14 PM
Noria Soltani
Noria Soltani - avatar
0
Here, we can solve all assignments😂😂😂
6th Jul 2020, 12:12 PM
@Danish🇦🇫
@Danish🇦🇫 - avatar
0
Maybe, but it is to our detriment😒😒
6th Jul 2020, 12:14 PM
‎Maryam Makhdoom
‎Maryam Makhdoom - avatar
0
Perhaps it will be ,but after solving our questions we can make sure ourselves here by posting our questions . And I guess it's not our detriment even it's gainful for us because SOLOLEARN gives us XP too and also we will submit our assignment comfortably 😁
6th Jul 2020, 12:21 PM
@Danish🇦🇫
@Danish🇦🇫 - avatar
0
I don't know what was the problem ,i replied to your message,but he didn't go. i said i will lose challenge😂😂
6th Jul 2020, 12:41 PM
‎Maryam Makhdoom
‎Maryam Makhdoom - avatar