File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 288

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: 4240
    
    7

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: 36453
    
  15
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: 4240
    
    7

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?
 
Similar Threads
RegularExpression in Java
Letter counter program. having trouble understanding it.
operator cannot be applied to ints.
using methods and counting uppercase characters
How do I use a static method from another class?