0

whats wrong?

why is this 2d ArrayList is putting all the smaller normal arrayLists in one bracket ("[ ]")? code: import java.util.*; public class Main { public static void main(String[] args){ ArrayList <String> drinks = new ArrayList<String>(); drinks.add ("fanta"); drinks.add ("sprite"); drinks.add ("coca cola"); ArrayList <String> burgers = new ArrayList<String>(); drinks.add ("burger"); drinks.add ("cheeseBurger"); drinks.add ("hamBurger"); ArrayList <String> markets = new ArrayList<String>(); drinks.add ("kopshop"); drinks.add ("ramiLevi"); drinks.add ("yeshHessed"); ArrayList <ArrayList<String>> food = new ArrayList(); food.add (drinks); food.add (burgers); food.add (markets); System.out.println(food); } }

4th Jul 2020, 9:42 AM
Yahel
Yahel - avatar
4 odpowiedzi
+ 1
oh... didnt see that (forgot to change)! thanks!
4th Jul 2020, 10:35 AM
Yahel
Yahel - avatar
4th Jul 2020, 10:21 AM
Yahel
Yahel - avatar