0
I don't get why my code isn't working
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner text = new Scanner(System.in); String word = text.nextLine(); String hello = "Hello"; if (word==hello){ System.out.println("Hi!"); } } }
1 Odpowiedź
+ 7
Use if (word.equals(hello)) instead of ==
🖒