Character class instance methods - Java Language Basics

Java examples for Language Basics:char

Description

Character class instance methods

Demo Code

public class Main 
{
   public static void main(String[] args)
   {/* w ww  .ja v a  2  s.  com*/
      Character c1 = 'A';
      Character c2 = 'a';

      System.out.printf(
         "c1 = %s\nc2 = %s\n\n", c1.charValue(), c2.toString());

      if (c1.equals(c2))
         System.out.println("c1 and c2 are equal\n");
      else
         System.out.println("c1 and c2 are not equal\n");
   } 
}

Result


Related Tutorials