I want to write a code that will show the user to input either a male or a female when asked to enter the sex. Firstly I created a class called SexeEnum as shown below
public enum SexeEnum {
Male,
Female
}
Then I want to ask the user to choose between the male or the female gender but I don't know how to proceed as shown below:
public static void main(String[] args) {
Utilisateur utilisateur = new Utilisateur();
Scanner u = new Scanner(System.in);
System.out.println("Enter your Name: ");
utilisateur.setNom(u.nextLine());
System.out.println("Enter your Sexe: ");
System.out.println("1-Male ");
System.out.println("2-Female ");
utilisateur.setSexe(u.nextLine());
}