I'm very new to java and taking a course on it in high school, we are just starting out with simple programs to get familiar with the syntax, but for some reason I am unable to use Scanner to input strings into string variables. The line of code just gets ignored. I've tried directly copy/pasting my teacher's notes he gives us, and they run fine in his own programs even when run on my computer, but they don't work in my programs. What am I doing wrong?
import java.util.Scanner;
public class Control5
{
public static void main (String [] args)
{
Scanner input = new Scanner(System.in);
String job;
System.out.println("1");
int years;
System.out.print("How many years have you been employed here? ");
years = input.nextInt();
System.out.print("Enter your job title: ");
job = input.nextLine();
if ((years > 5) & (job.toLowerCase() == "salesman")) {
System.out.println("Eligible for promotion.");
}
else {
System.out.println("Not eligible for promotion.");
}
}
}