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...

This preview shows page 1 - 3 out of 3 pages.

PARTICIPATION ACTIVITY 3.11.1: Character methods. To what value does each evaluate? userStr is "Hey #1?". 1) Character.isLetter('7') True False Correct '7' is not an alphabetic letter (a-z or A-Z.) 2) Character.isLetter(userStr.charAt(0)) True False Correct 'H' is alphabetic. 3) Character.isWhitespace(userStr.charAt(3)) True False Correct That character is a space ' ' between the y and #. 4) Character.isDigit(userStr.charAt(6)) True False Correct That character is '?'. 5) Character.toUpperCase(userStr.charAt(1)) returns 'E'. True False Correct 'e' becomes 'E'.
Image of page 1
6) Character.toLowerCase(userStr.charAt(2)) yields an error because 'y' is already lower case . True False Correct No error, just returns 'y'. 7) Character.toLowerCase(userStr.charAt(6)) yields an error because '?' is not alphabetic. True False Correct No error, just returns '?'. CHALLENGE ACTIVITY 3.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);
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 3 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture