Summary


Java Primitive Type Wrapper Classes

For every Java primitive data type there exists a corresponding Java wrapper class that can be used to add functionality to primitive types. The wrapper classes are found in the java.lang package. Table 6-5 lists the primitive types, their corresponding wrapper classes, and some methods of interest supplied by each wrapper class.

Table 6-5: Primitive Type Wrapper Classes

Primitive Type

Wrapper Class

Methods of Interest

char

Character

The Character class provides many class field constants and methods(). There are too many to list them all here. You’ve seen two Character static class methods in action in this chapter. They are isJavaIdentifierStart(char c), and isJavaIdentifierPart(char c). Other methods you may find immediately helpful include: toLowerCase(char c), toUpperCase(char c), and toTitleCase(char c). Take the time to look up this class in the Java platform API documentation.

byte

Byte

parseByte(String s), toString(byte b), longValue(), intValue(), shortValue(), doubleValue(), floatValue(), toString()

short

Short

parseShort(String s), intValue(), longValue(), byteValue(), doubleValue(), intValue(), floatValue(), toString()

long

Long

parseLong(String s), intValue(), shortValue(), byteValue(), doubleValue(), floatValue(), toString()

int

Integer

parseInt(String s), longValue(), floatValue(), shortValue(), byteValue(), doubleValue(), toString()

float

Float

parseFloat(String s), byteValue(), shortValue(), longValue(), intValue(), doubleValue(), toString()

double

Double

parseDouble(String s), floatValue(), byteValue(), shortValue(), longValue(), intValue(), toString()

boolean

Boolean

getBoolean(String name), toString(Boolean b), toString()




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net