0
Printing out information from an arraylist
so i have this project (college homework) and i need to show the preview of the shopping car(elements, cost) but with the method i'm using i only get one of the items. help psl i add the link with the code https://drive.google.com/file/d/0B2WgC5JnH2wfbXhUUGc3WlVIS0k4SnA1WkpBTWxvbTF5bzlR/view?usp=drivesdk
4 Answers
0
the arraylist class in java has already defined. tostring method. and you can use it in two ways:
imagine your arraylist's name is list. use one of the options below
System.out.print(list);
System.out.print(list.toString());
0
I did it but it shows only the codes of the videogames like this:
modelo.videojuego@aszxd12
is there a way to print like the name, price and everything?
0
you have to define a .toString method for you videogames class too
0
this is another version. is working nicely till i insert the quantity and gives me a null pointer exception. any advice?
https://drive.google.com/folderview?id=0B2WgC5JnH2wfUFZ0a2NOUkFGblk