+ 1
help with java
Does anyone know why this code doesn't output hi if the input is hello import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner a = new Scanner(System.in); if(a.next() == "hello"){ System.out.println("hi"); } } }
1 Answer
+ 4
if(a.next().equals("hello")){
System.out.println("hi");
}