int i=0;
String x[]= new String[i];
while(true){
if(x[i]!="stop") {
x[i]=in.nextLine();
i++;
return;
}
}
I want the user to input text hit enter, input some other text and hit enter etc. until the user types "stop". I then want the array x[i]
to have all the different inputs to be stored as its elements.
NetBeans keep sending
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at app.App.main(App.java:46)
How can I fix this?