Chapter16c.java
Select all
/* Chater16c.java CIS 260 David Klick 2016-02-15 This program demonstrates several static Character class methods. */ public class Chapter16c { public static void main(String[] args) { System.out.println(" \t This is the text \t ".trim()); System.out.println("Can you pick out the secret".substring(21)); System.out.println("Can you pick one word out of a line".substring(17,21)); for (char c : "This 2 shall pass".toCharArray()) { System.out.print(c + ": "); if (Character.isLetter(c)) { System.out.print("letter "); if (Character.isLowerCase(c)) System.out.print("lower "); if (Character.isUpperCase(c)) System.out.print("upper "); } if (Character.isDigit(c)) System.out.print("digit "); if (Character.isWhitespace(c)) System.out.print("whitespace "); System.out.println(); } } }