I am looking to pass a long list of results in a String toString() method,this is my code
public void newlist(){
for(int i = 0 ; i <= nbComposant;i++){
System.out.print(ref+i+" (quantity "+quantity+i+")");
}
}
public String toString(){
return newlist();
}
What's wrong with it?
void. Should be String.newListseparate method? Also why does it not return anything (its return type isvoid)?refandquantityarrays? Do you intend to print each element of these arrays on separate lines?