java.lang
Class Character

java.lang.Object
  |
  +--java.lang.Character

public final class Character
extends Object

The Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field whose type is char.

In addition, this class provides several methods for determining the type of a character and converting characters from uppercase to lowercase and vice versa.

Since:
JDK1.0

Field Summary
static int MAX_RADIX
          The maximum radix available for conversion to and from Strings.
static char MAX_VALUE
          The constant value of this field is the largest value of type char.
static int MIN_RADIX
          The minimum radix available for conversion to and from Strings.
static char MIN_VALUE
          The constant value of this field is the smallest value of type char.
 
Constructor Summary
Character(char value)
          Constructs a Character object and initializes it so that it represents the primitive value argument.
 
Method Summary
 char charValue()
          Returns the value of this Character object.
static int digit(char ch, int radix)
          Returns the numeric value of the character ch in the specified radix.
 boolean equals(Object obj)
          Compares this object against the specified object.
 int hashCode()
          Returns a hash code for this Character.
static boolean isDigit(char ch)
          Determines if the specified character is a digit.
static boolean isLowerCase(char ch)
          Determines if the specified character is a lowercase character.
static boolean isUpperCase(char ch)
          Determines if the specified character is an uppercase character.
static char toLowerCase(char ch)
          The given character is mapped to its lowercase equivalent; if the character has no lowercase equivalent, the character itself is returned.
 String toString()
          Returns a String object representing this character's value.
static char toUpperCase(char ch)
          Converts the character argument to uppercase; if the character has no lowercase equivalent, the character itself is returned.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_RADIX

public static final int MAX_RADIX
The maximum radix available for conversion to and from Strings. The constant value of this field is the largest value permitted for the radix argument in radix-conversion methods such as the digit method, the forDigit method, and the toString method of class Integer.
See Also:
Integer.toString(int, int), Integer.valueOf(java.lang.String)

MAX_VALUE

public static final char MAX_VALUE
The constant value of this field is the largest value of type char.
Since:
JDK1.0.2

MIN_RADIX

public static final int MIN_RADIX
The minimum radix available for conversion to and from Strings. The constant value of this field is the smallest value permitted for the radix argument in radix-conversion methods such as the digit method, the forDigit method, and the toString method of class Integer.
See Also:
Integer.toString(int, int), Integer.valueOf(java.lang.String)

MIN_VALUE

public static final char MIN_VALUE
The constant value of this field is the smallest value of type char.
Since:
JDK1.0.2
Constructor Detail

Character

public Character(char value)
Constructs a Character object and initializes it so that it represents the primitive value argument.
Parameters:
value - value for the new Character object.
Method Detail

charValue

public char charValue()
Returns the value of this Character object.
Returns:
the primitive char value represented by this object.

digit

public static int digit(char ch,
                        int radix)
Returns the numeric value of the character ch in the specified radix.
Parameters:
ch - the character to be converted.
radix - the radix.
Returns:
the numeric value represented by the character in the specified radix.
Since:
JDK1.0
See Also:
isDigit(char)

equals

public boolean equals(Object obj)
Compares this object against the specified object. The result is true if and only if the argument is not null and is a Character object that represents the same char value as this object.
Overrides:
equals in class Object
Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.

hashCode

public int hashCode()
Returns a hash code for this Character.
Overrides:
hashCode in class Object
Returns:
a hash code value for this object.

isDigit

public static boolean isDigit(char ch)
Determines if the specified character is a digit.
Parameters:
ch - the character to be tested.
Returns:
true if the character is a digit; false otherwise.
Since:
JDK1.0

isLowerCase

public static boolean isLowerCase(char ch)
Determines if the specified character is a lowercase character.
Parameters:
ch - the character to be tested.
Returns:
true if the character is lowercase; false otherwise.
Since:
JDK1.0

isUpperCase

public static boolean isUpperCase(char ch)
Determines if the specified character is an uppercase character.
Parameters:
ch - the character to be tested.
Returns:
true if the character is uppercase; false otherwise.
Since:
1.0
See Also:
isLowerCase(char), toUpperCase(char)

toLowerCase

public static char toLowerCase(char ch)
The given character is mapped to its lowercase equivalent; if the character has no lowercase equivalent, the character itself is returned.
Parameters:
ch - the character to be converted.
Returns:
the lowercase equivalent of the character, if any; otherwise the character itself.
Since:
JDK1.0
See Also:
isLowerCase(char), isUpperCase(char), toUpperCase(char)

toString

public String toString()
Returns a String object representing this character's value. Converts this Character object to a string. The result is a string whose length is 1. The string's sole component is the primitive char value represented by this object.
Overrides:
toString in class Object
Returns:
a string representation of this object.

toUpperCase

public static char toUpperCase(char ch)
Converts the character argument to uppercase; if the character has no lowercase equivalent, the character itself is returned.
Parameters:
ch - the character to be converted.
Returns:
the uppercase equivalent of the character, if any; otherwise the character itself.
Since:
JDK1.0
See Also:
isLowerCase(char), isUpperCase(char), toLowerCase(char)


Copyright 1999-2007 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.