Tuesday, March 17, 2015

Generic Java Class for Looping yes or no in order to validate user choices

package Diplay;

public class Generic {
   
    public static void MessageToLoop(String S) {

        char reponse = 'n';
        Scanner sc = new Scanner(System.in);

        while (reponse == 'n')
        {
       
        System.out.println(S);
        System.out.println(" ? (Y/N)");
        reponse = sc.nextLine().charAt(0);
        }
        }
}

No comments:

Post a Comment

Popular Posts