I wrote a simple entry based program, and the scanner is skipping over it. I have tried various methods that have helped in the past, but to no avail. I appreciate all help.
The below code is all the code in my main method.
Scanner scan = new Scanner(System.in);
ArrayList <String> list = new ArrayList <String> ( );
System.out.println("You can choose any of the following:");
System.out.println("\n - Add: Add an element to the Array List.");
System.out.println("\n - Numbered Remove: Remove an element by it's placement in the Array List.");
System.out.println("\n - Named Remove: Remove an element by name.");
System.out.println("\n - Clear: Clear the entire Array List");
System.out.println("\n - Search: Find a specific element, and the amount of occurences in the Array List.");
System.out.println("\n - Find Size: Prints the size of each element in the Array List.");
System.out.println("\n - Print: Prints the entire Array List.");
System.out.println("\n - Quit: Quits the program.");
System.out.println();
System.out.println();
System.out.println("Type the FIRST word of each listing EXACTLY in order to continue.");
System.out.print("--> ");
String program = scan.nextLine();
String prgm = program.toLowerCase();
if (prgm == "add")
{
add(list);
}
if (prgm == "numbered")
{
numbered(list);
}
if (prgm == "named")
{
named(list);
}
if (prgm == "clear")
{
clear(list);
}
if (prgm == "search")
{
search(list);
}
if (prgm == "find")
{
find(list);
}
if (prgm == "print")
{
print(list);
}
if (prgm == "quit")
{
System.out.println("Goodbye.");
}
String prgm = program.toLowerCase();