This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Character Problem!

 
Zafar Ali
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one help me ...
how can takes a character as input and then classify it.
(Hint A-Z (65-90), a-z(97-122) and 0-9 (48-57).
 
Norm Miller
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this!
char cc = '9'; // just for testing
if (Character.isLowerCase(cc))
System.out.println(" Lower case ");
if (Character.isUpperCase(cc))
System.out.println(" Upper case ");
if (Character.isDigit(cc))
System.out.println(" Digit ");
// getType also works
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic