how do I make a pile of objects in java? what I want to put is identifier and color

-1
 * and open the template in the editor.
 */
package com.lcda.pila.modelo;

/**
 *
 * @author geovanny9596
 */
public class Plato {
    private String identificador;
    private String color;

    public String getIdentificador() {
        return identificador;
    }

    public void setIdentificador(String identificador) {
        this.identificador = identificador;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }



}
    
asked by Esteban Geovanny 03.10.2018 в 03:48
source

1 answer

-1

Try this:

Stack<Plato> pila = new Stack<Plato>();
Plato p1 = new Plato("P1","rojo");

pila.push(p11);

to extract the elements you can use:

pila.pop();

Note: in the example of the model that you believe the constructor of the class needs.Greetings

    
answered by 03.10.2018 в 14:51