1
I have a java class representing an entity snack,follows below the class:
public class Lanche {
private String nome;
private int id;
private double preco;
private String[] ingredientes;
/*getters setters */
}
Below follows the test class in which I am instantiating a snack object and setting the attributes:
public class Teste {
public static void main(String[] args) {
Lanche lanche = new Lanche();
lanche.setId(001);
lanche.setNome("X-salada");
lanche.setPreco(5.00);
lanche.setIngredientes("Hamburguer","Queijo","Salada");
}
}
How to correctly set the ingredients attribute, which is an array of strings? Because as I exemplified this giving the following error:
The method setIngredientes(String[]) in the type Lanche is not applicable for the Arguments (String, String, String)
Perfect, thank you.
– Rodrigo Lima dos Santos