Labs
For this lab we will accept user input and use information about the ASCII characters.
- Write a program to prompt the user for a String and check if the String meets certain conditions.
- Use
Scanner.nextLine()to read in aStringthat may contain spaces. - Check if all characters in an input String are letters (upper or lower) and print a messaging saying the result.
- Some
Stringmethods you might use:stringInstance.length()- get the length of theString.stringInstance.charAt(i)- get thecharat indexi, which starts at0(like an array index).
(Solution: AlphaNumCheck.java)
- Modify the program in (1) to see if the characters are alphanumeric (letters and numbers) or the space character.
(Solution: AlphaNumCheck2.java)