结果必须是大于单词“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");
}
}