Advertisement
thejman094

SUmmberCOdeInputLetter

May 5th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import java.util.*;
  2. import static java.lang.Character.*;
  3.  
  4. public class jman{
  5. public static void main(String []args){
  6. Scanner scan = new Scanner(System.in);
  7. System.out.print("Input String here: ");
  8. String str =scan.nextLine();
  9. int countLetters=0;
  10. for(int i=0; i<str.length(); i++){
  11. if(isLetter(str.charAt(i))){
  12. countLetters++;
  13. }
  14. }
  15. System.out.println("The String "+str+" has: "+countLetters);
  16. }
  17.  
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement