kanciastopantalones

zad 6 czy qwiecej duzych czy malych

Dec 6th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. for (int k = 0; k < input.length(); k++) {
  2. /**
  3. * The methods isUpperCase(char ch) and isLowerCase(char ch) of the Character
  4. * class are static so we use the Class.method() format; the charAt(int index)
  5. * method of the String class is an instance method, so the instance, which,
  6. * in this case, is the variable `input`, needs to be used to call the method.
  7. **/
  8. // Check for uppercase letters.
  9. if (Character.isUpperCase(input.charAt(k))) upperCase++;
  10.  
  11. // Check for lowercase letters.
  12. if (Character.isLowerCase(input.charAt(k))) lowerCase++;
  13. }
  14.  
  15. System.out.printf("There are %d uppercase letters and %d lowercase letters.",upperCase,lowerCase);
Add Comment
Please, Sign In to add comment