結果は、単語「END」より大きい文字列でなければなりません。これが私がこれまで行ってきたことですが、うまくいきません。
System.out.println("Write a word. The word "END" terminates the program");
String word = sc.nextLine();
if(word.equals("END")){
System.out.println("Nothing has been typed");
}
while(word!="END"){
if(word.compareTo("END") > 0){
System.out.println(word+" is greater than END");
}
}