This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

comparing character in java: uppercase, lowercase, or symbol?

 
mark donner
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am trying to learn java. What is wrong with my code below. Thank you very much for your help!

(program is for java to tell what kind of character it is)



[Edit: added code tags - MB]
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can not compare the char with the String , "A" is a String not a char ('A')

Please follow the posting guideline

Below code can solve your problem
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And do please UseCodeTags henceforth
 
Matthew Brown
Bartender
Posts: 4565
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to look more carefully at those if statements - there's an error in the logic.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch
 
Campbell Ritchie
Sheriff
Posts: 48410
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read carefully through the Character class; you may find something very useful for your problem there.
 
mark donner
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for everyone's help. Sorry about not doing the codetags.

What wrong with the logic?

thank you
 
Matthew Brown
Bartender
Posts: 4565
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mark donner wrote:What wrong with the logic?
You sure those should both be "<="?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic