IT IT 145 ZyBooks 3.11.docx - PARTICIPATION ACTIVITY 3.11.1 Character methods To what value does each evaluate userStr is\"Hey#1 1 Character.isLetter'7
IT IT 145 ZyBooks 3.11.docx - PARTICIPATION ACTIVITY 3.11.1...
100%(28)28 out of 28 people found this document helpful
This preview shows page 1 - 3 out of 3 pages.
PARTICIPATIONACTIVITY3.11.1: Character methods.To what value does each evaluate? userStr is "Hey #1?".1)Character.isLetter('7')TrueFalseCorrect'7' is not an alphabetic letter (a-z or A-Z.)2)Character.isLetter(userStr.charAt(0))TrueFalseCorrect'H' is alphabetic.3)Character.isWhitespace(userStr.charAt(3))TrueFalseCorrectThat character is a space ' ' between the y and #.4)Character.isDigit(userStr.charAt(6))TrueFalseCorrectThat character is '?'.5)Character.toUpperCase(userStr.charAt(1)) returns 'E'.TrueFalseCorrect'e' becomes 'E'.
6)Character.toLowerCase(userStr.charAt(2)) yields an error because 'y' is already lower case .TrueFalseCorrectNo error, just returns 'y'.7)Character.toLowerCase(userStr.charAt(6)) yields an error because '?' is not alphabetic.TrueFalseCorrectNo error, just returns '?'.CHALLENGEACTIVITY3.11.1: String with digit.Set hasDigit to true if the 3-character passCode contains a digit. import java.util.Scanner;public class CheckingPasscodes {public static void main (String [] args) {Scanner scnr = new Scanner(System.in);