I have a java class that represents a snack , below the class:
public class Lanche {
private String nome;
private int id;
private double preco;
private String[] ingredientes;
/*getters setters */
}
Below is the test class in which I'm 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 properly set the ingredients attribute, what is an array of strings? Because of the way I have exemplified this it gives the following error:
The method setIngredients (String []) in the type Snack is not applicable for the arguments (String, String, String)