java compare char

Java Character compareTo() Example

Many methods exist in java.lang.Character class used for different purposes. Some methods are useful for checking the character is a digit or letter or is a uppercase letter or lowercase letter etc. At the sametime, some methods can modify the case of the letters from uppercase to lowercase or vice…

Char Comparison Java

For comparing two characters logical equals (==) operator can be used. Alternatively, the chars can be passed to Character constructor and compared with equals() method. The following program illustrates. Program on Char Comparison Java

Output screenshot on Char Comparison Java Two characters can be compared using logical equals (==)…