import java.util.Scanner;
public class stringComparer {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
System.out.println ("Enter 1 word here - ");
String word1 = scan.next();
System.out.println ("Enter another word here - ");
String word2 = scan.next();
if (word1 == word2) {
System.out.println("They are the same");
}
}
}
我是有工作的約10分鐘前,改變了一些東西,現在它不顯示「他們是相同的」由於某種原因?它非常簡單,但我不明白我出錯的地方。
謝謝!