3
I have this method that adds things to the list:
public Pedido adicionarPedido(int quantidade, String nome){
lista.add(new Item(quantidade, nome ));
return this;
}
And I’ve entered that class into the list attributes :
List<Item> lista = new ArrayList<Item>();
I am asking to display in the toString method the list data plus the person’s name:
public Pedido ToString() {
mensagem = "Pedido [lista=" + lista.get(0) + lista.get(1) + ", cliente=" + cliente.getNome() + "]";
return this;
}
The problem is that the console is being printed like this:
Pedido [lista=teste.Item@15db9742 teste.Item@6d06d69c, cliente=Aline Gonzaga]
But I want the list items printed out.
How can I do that?
How’s your class Request?
– user28595
What should I print? and I reinforce the request to post the class
Pedido
.– Maniero