Hello How do I convert in a ArrayList<> something to String I will show you my code I am really bad a at explaining stuff sorry:
ArrayList<HerniObjekt> batoh = new ArrayList<>();
public void pridej(HerniObjekt objekt)
{
batoh.add(objekt);
}
public void vypis()
{
JOptionPane.showMessageDialog(null, "Mas v Inevtari "+batoh.);
}
And I would like to convert the HerniObject to String how do I do that? thanks for your help.
HerniObektlook like? Which String you would like to get from each object? And finally, what have you tried?package javagame; import java.awt.Graphics; public abstract class HerniObjekt { int y; int x; int smerx; int smery; int rychlost; public abstract void krok(); public abstract void vykresli(Graphics g); }and I tried HenriObject.toString