Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to use a while statement with char in java

    private static char getHighLow(Scanner keyboard) 
{
    System.out.println("High, Low, or Sevens (H/L/S): ");
    String choiceString = keyboard.next();

    char choice = choiceString.charAt(0);

    while (choice != 'H' || choice != 'h' || choice != 'L' || choice != 'l' || choice != 'S' || choice != 's')
    {
        System.out.println("You have entered an invalid entry.");
        System.out.println("High, Low, or Sevens (H/L/S): ");
        choiceString = keyboard.next();
    }

    return choice;

}
Comment

PREVIOUS NEXT
Code Example
Java :: Load array of strings from console 
Java :: Permutations of array in Java 
Java :: convert python to java 
Java :: java to python 
Java :: android java how to stop users fromgoing back too much 
Java :: fragment to activity typecasting 
Java :: java 8 iterating and manipulating list 
Java :: how todo a timeout test java 
Java :: add checkbox box rows in tabulator 
Java :: java regex of eauations 
Java :: control flow graph generator 
Java :: android pick up photo from local device 
Java :: labeled break Statement Java 
Java :: .code domain 
Java :: list in list 
Java :: what is java.io example 
Java :: iterator java8 
Java :: tick mark android 
Java :: transform primitive float array to float array 
Java :: spring boot dto example java 
Java :: data validation dialog box android 
Java :: interview questions on ds and algo 
Java :: How to make sure a servlet is loaded at the application startup? 
Java :: java filewriter not working 
Java :: spring import properties file xml 
Java :: aggregationoperation multi match 
Java :: java pattern matching 16 
Java :: ldap java connection 
Java :: how to use old android studio project 
Java :: mile to nautical mile 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =