I have a problem. If I assign a word to a string directly (by doing s="pass"), the code works the way I want. But if I try to assign it use a scanner, it seems to just skip over the if statement. I'm obviously new to java, could someone please try to help me?
import java.util.Scanner;
public class main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String s;
    s=scan.next();
    if(s=="pass"){
        System.out.println("CORRECT");
    }
    else{
        System.out.println("INCORRECT");
    }
  }
}
I have imported the Scanner properly.
 
     
     
     
     
    