wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes comparing character in java: uppercase, lowercase, or symbol? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "comparing character in java: uppercase, lowercase, or symbol?" Watch "comparing character in java: uppercase, lowercase, or symbol?" New topic
Author

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

mark donner
Greenhorn

Joined: Oct 08, 2011
Posts: 17
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

Joined: Feb 18, 2008
Posts: 289

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


-Chiru
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
And do please UseCodeTags henceforth
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4363
    
    8

You might want to look more carefully at those if statements - there's an error in the logic.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Welcome to JavaRanch
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38349
    
  23
Read carefully through the Character class; you may find something very useful for your problem there.
mark donner
Greenhorn

Joined: Oct 08, 2011
Posts: 17
Thank you very much for everyone's help. Sorry about not doing the codetags.

What wrong with the logic?

thank you
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4363
    
    8

mark donner wrote:What wrong with the logic?
You sure those should both be "<="?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: comparing character in java: uppercase, lowercase, or symbol?