import java.util.Scanner;
public class userInputTest {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for(int i = 0; i>-1; i=i+1){
String[] giveMeAString = new String[i+1];
String x = sc.next();
giveMeAString[i]=x;
if(i>=0){
if (giveMeAString[i].length() < giveMeAString[i-1].length()){
System.out.println("The string is shorter than previous string!");
break;}
}
}
}
}
I want to loop until present user input length is less than previous user input length.
I haven't solved it for a while after many attempta.
what am I doing wrong? I want to use Array, because I also want to print the user inputs out later on.
The only problem I have now is to make the written code work.