Вы находитесь на странице: 1из 6

// Constants of Character, radix, methods.

// Code Points
// Study Primitive Type Wrappers

1. java.lang.String
: String, StringBuffer and StringBuilder all are final and cannot be sub
classed.
: All extend the java.lang package.
: All implement the CharSequence interface.
: Constructors
String()
String(char[])
String(char[], int startIndex, int numChars)
String(String)
String(byte[])
byte ascii[] = {65, 66, 67, 68, 69, 70 };
String s1 = new String(ascii);
s1 = ABCDEF
String(byte[], int startIndex, int numChars)
String(StringBuffer)
String(StringBuilder)
: Methods
#
#
#
#
#
#

char[] toCharArray() - one of the most important methods


length()
equals(String) equalsIgnoreCase(String)
int compareTo(String)
int compareToIgnoreCase(String)
Every class implements toString() as it is defined in Object c

lass
# char charAt(int where)
# void getChars(int sourceStart, int sourceEnd, char target[ ],
int targetStart) - get multiple characters in target;
# boolean regionMatches(int startIndex, String str2, int str2Sta
rtIndex, int numChars)
# boolean regionMatches(boolean ignoreCase, int startIndex, Stri
ng str2, int str2StartIndex, int numChars)
# boolean startsWith(String)
# boolean startsWith(String str, int startIndex)
# boolean endsWith(String)
# int indexOf(char/String)
# int indexOf(char/String, int startIndex)
# int lastIndexOf(char/String)
# int lastIndexOf(char/String, int startIndex)
# String substring(int startIndex)
# String substring(int startIndex, int endIndex)
# String concat(String)
# String replace(char orig, char new)
# String replace(CharSequence orig, CharSequence new)
# String trim()
# static String valueOf(Object/char/int/double/...) - these are
all overloaded in String class
# static String valueOf(char chars[ ], int startIndex, int numCh
ars)
# String toLowerCase(), String toUpperCase()
# static String join(CharSequence delimiter, CharSequence ... ar
gs)

# String[] split(String regExp, int max)


If max is negative, then the invoking string is fully de
composed.
If max contains a nonzero value, the last entry in the r
eturned array contains the remainder of the invoking string.
If max is zero, the invoking string is fully decomposed,
but no trailing empty strings will be included.
# String[] split(String regExp)
: See page 431 of The complete reference

2. java.lang.StringBuffer
: Constructors
# StringBuffer() - 16 characters
# StringBuffer(int size)
# StringBuffer(String) - size of given String + 16 characters
# StringBuffer(CharSequence)
: Methods
# int length()
# int capacity()
# void ensureCapacity(int minCapacity) - A buffer larger than mi
nCapacity may be allocated for reasons of efficiency
# void setLength(int len) - sets length. len must be non-negativ
e. It adds a null character after specified length of buffer.
# char charAt(int where)
# void setCharAt(int where, char ch)
# void getChars(int sourceStart, int sourceEnd, char target[], i
nt targetStart)
# StringBuffer append(Object/String/char/int/...) - String repre
sentation of data type is called by String.valueOf().
# StringBuffer insert(int where, Object/String/char/int/...) - S
tring representation is called by String.valueOf().
# StringBuffer reverse()
# StringBuffer delete(int startIndex, int endIndex)
# StringBuffer deleteCharAt(int index)
# StringBuffer replace(int startIndex, int endIndex, String str)
# StringBuffer substring(int start)
# StringBuffer substring(int start, int end)
# int indexOf/lastIndexOf(String str, int startIndex) - startInd
ex is optional. returns -1 if not found.

3. java.lang.StringBuilder
: The advantage of StringBuilder is faster performance. However, in case
s in which a mutable string will be accessed by multiple threads, and no externa
l synchronization is employed, you must use StringBuffer rather than StringBuild
er.
: Added in JDK 5.

4. [not completed] Primitive Type Wrappers


: The abstract class Number defines a superclass that is implemented by
the classes that wrap the numeric types byte, short, int, long, float, and doubl

e. Number has abstract methods that return the value of the object in each of th
e different number formats. For example, doubleValue( ) returns the value as a d
ouble, floatValue( ) returns the value as a float, and so on.
# byte byteValue( )
# double doubleValue( )
# float floatValue( )
# int intValue( )
# long longValue( )
# short shortValue( )
: Double and Float
:: Constructors for Float
# Float(double num)
# Float(float num)
# Float(String str) throws NumberFormatException
:: Constructors for Double
# Double(double num)
# Double(String str) throws NumberFormatException
:: Constants in Double and Float
# BYTES - The width of a float or double in bytes (Added
by JDK 8.)
#
#
#
#
#
#
#
#
#
#

MAX_EXPONENT - Maximum exponent


MAX_VALUE - Maximum positive value
MIN_EXPONENT - Minimum exponent
MIN_NORMAL - Minimum positive normal value
MIN_VALUE - Minimum positive value
NaN - Not a number
POSITIVE_INFINITY - Positive infinity
NEGATIVE_INFINITY - Negative infinity
SIZE - The bit width of the wrapped value
TYPE - The Class object for float or double

:: Methods of Float
#
#
#
#
#
#

byte byteValue()
float floatValue()
double doubleValue()
int intValue()
long longValue()
short shortValue()

#
#
#
#
#
#
#
#

static
static
static
static
static
static
static
static

int compare(float n1, float n2)


int hashCode(float n)
boolean isFinite(float num)
boolean isInfinite(float num)
boolean isNaN(float n)
float max(float a, float b)
float min(float a, float b)
float parseFloat(String str) throws NumberForma

#
#
#
#
#

static
static
static
static
static

float sum(float a, float b)


String toHexString(float num)
String toString(float num)
Float valueOf(float num)
Float valueOf(String num) throws NumberFormatEx

tException

ception
# int compareTo(Float f)
# boolean equals(Object f)

#
#
#
#

int hashCode()
boolean isFinite()
boolean isNaN()
String toString()

:: Methods of Double
#
#
#
#
#
#

byte byteValue()
float floatValue()
double doubleValue()
int intValue()
long longValue()
short shortValue()

#
#
#
#
#
#
#
#

static
static
static
static
static
static
static
static

int compare(double n1, double n2)


int hashCode(double n)
boolean isFinite(double num)
boolean isInfinite(double num)
boolean isNaN(double n)
double max(double a, double b)
double min(double a, double b)
double parseDouble(String str) throws NumberFor

#
#
#
#
#

static
static
static
static
static

double
String
String
Double
Double

#
#
#
#
#
#

int compareTo(Double f)
boolean equals(Object f)
int hashCode()
boolean isFinite()
boolean isNaN()
String toString()

matException
sum(double a, double b)
toHexString(double num)
toString(double num)
valueOf(double num)
valueOf(String num) throws NumberFormatE

xception

: Byte Short Integer Long


:: Constructors
# DataType(datatypePrimitive num)
# DataType(String str) throws NumberFormatException
:: CONSTANTS
# BYTES
# MIN_VALUE
# MAX_VALUE
# SIZE
# TYPE
:: Methods Integer see page 448
# byte byteValue()
# double doubleValue()
# float floatValue()
#
#
#
#

static
static
static
static

int bitCount(int num)


int compare(int n, int m)
int compareUnsigned(int n, int m)
Integer decode(String str) throws NumberFormatE

xception
# static int divideUnsigned(int divi, int divisor)

# int compareTo(Integer i)
# boolean equals(Object)
: Character
:: Character(char)
:: Methods
# char charValue()
# static boolean isDigit(char)
# static boolean isLetter(char)
# static boolean isWhitespace(char)
# static boolean isUpperCase(char)
# static boolean isLowerCase(char)
# static char forDigit(int num, int radix)
# static int digit(char digir, int radix)
# int compareTo(Character)
:: CONSTANTS
# BYTES
# MAX_RADIX
# MIN_RADIX
# MAX_VALUE
# MIN_VALUE
# TYPE
: Boolean
:: Boolean(boolean)
:: Boolean(String bool)
:: Constants
# TRUE
# FALSE
# TYPE

5. java.lang.Void
: TYPE - constant
: Holds a reference to the Class object for type void. You do not create
instances of this class

6. [not completed] java.lang.Math


: CONSTANTS
# PI
# E
: Trigonometric Methods
# static double sin/cos/tan(double)
# static double asin/acos/atan(double)
# static double atan2(double, double)
# static double sinh/cosh/tanh(double)
: Exponential Methods
# static double cbrt/sqrt(double) - cube root and square root
# static double exp(double) - e^n
# static double expm1(double) - e^(n-1)
# static double log/log10(double)
# static double log1p(double) - log(e) n+1
# static double pow(double, double)
# static double/float scalb(double/float a, int f) - a*2^f
: Rounding Methods
# static int/long/double/float abs(int/long/double/float)

# static double ceil/floor(double)


# static int/long floorDiv(int/long, int/long) - floor of arg1/a
rg2
# static int/long floorMod(int/long, int/long) - floor of arg1%a
rg2
# static T max/min(T, T) - T = int, long, float, double
# static double rint(double)
# static int/long round(float/double)