"Source not found." appears when the program try to get a char from user. What character I input for testing is '3'. We can also encounter the same problem when we try other characters except '5'.
Code:
package assignment1;
import java.util.Scanner;
public class main_menu {
    private static char main_menu_choice = '0';
    private static void setMainMenuChoice(char choice) {
        main_menu_choice = choice;
    }
    private static char getMainMenuChoice() {
        return main_menu_choice;
    }
    public static void main(String[] args) {
        do {
            showMainMenu();
            setMainMenuChoice( getChoiceFromUser() );
        } while (getMainMenuChoice() != '5');
    }
    private static void showMainMenu() {
        System.out.println("----------------Main Menu----------------");
        System.out.println("1. Initialize the address book");
        System.out.println("2. Create person contact information");
        System.out.println("3. Lookup person contact information");
        System.out.println("4. Lookup all person contact information");
        System.out.println("5. Quit");
        System.out.println();
        System.out.print("Enter your choice : ");
    }
    private static char getChoiceFromUser() {
        Scanner reader = new Scanner(System.in); <--------"Source not found."
        char choice = reader.next().charAt(0);
        reader.close();
        return choice;
    }
}
How to solve this problem?
 
     
     
     
    