EarthWeb sites:
|
|
appendix J
java.lang
Package Reference
CONTENTS
The java.lang package provides
the core classes that make up the Java programming environment.
The language package includes classes representing numbers, strings,
and objects, as well as classes for handling compilation, the
runtime environment, security, and threaded programming. The java.lang
package is automatically imported into every Java program.
This interface indicates that an object may be cloned using the
clone method defined in Object.
The clone method clones an
object by copying each of its member variables. Attempts to clone
an object that doesn't implement the Cloneable
interface result in a CloneNotSupportedException
being thrown.
This interface provides a means for an object to be executed within
a thread without having to be derived from the Thread
class. Classes implementing the Runnable
interface supply a run method
that defines the threaded execution for the class.
run
public abstract void run()
This method is executed when a thread associated with
an object implementing the Runnable
interface is started. All of the threaded execution for the object
takes place in the run method,
which means you should place all threaded code in this method.
Extends: Object
This class implements an object type wrapper for boolean
values. Object type wrappers are useful because many Java classes
operate on objects rather than primitive data types.
Member Constants
public final static Boolean FALSE
This is a constant Boolean
object representing the primitive boolean value false.
public final static Boolean TRUE
This is a constant Boolean
object representing the primitive boolean value true.
Boolean Constructor
public Boolean(boolean value)
This constructor creates a boolean wrapper object
representing the specified primitive boolean value.
Parameters: value-the
boolean value to be wrapped.
Boolean Constructor
public Boolean(String s)
This constructor creates a boolean wrapper object
representing the specified string. If the string is set to "true",
the wrapper represents the primitive boolean value true;
otherwise, the wrapper represents false.
Parameters: s-the
string representation of a boolean value to be wrapped.
booleanValue
public boolean booleanValue()
This method determines the primitive boolean value
represented by this object.
Returns: The boolean value represented.
equals
public boolean equals(Object obj)
This method compares the boolean value of the specified
object to the boolean value of this object. The equals
method returns true only
if the specified object is a Boolean
object representing the same primitive boolean value as this object.
Parameters: obj-the
object to compare.
Returns: true
if the specified object is a Boolean
object representing the same primitive boolean value as this object;
false otherwise.
getBoolean
public static boolean getBoolean(String
name)
This method determines the boolean value of the system
property with the specified name.
Parameters: name-the
system property name to check the boolean value of.
Returns: The boolean value of the specified system
property.
hashCode
public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.
toString
public String toString()
This method determines a string representation of
the primitive boolean value for this object. If the boolean value
is true, the string "true"
is returned; otherwise, the string "false"
is returned.
Returns: A string representing the boolean value
of this object.
valueOf
public static Boolean valueOf(String
s)
This method creates a new boolean wrapper object based
on the boolean value represented by the specified string. If the
string is set to "true",
the wrapper represents the primitive boolean value true;
otherwise, the wrapper represents false.
Parameters: s-the
string representation of a boolean value to be wrapped.
Returns: A boolean wrapper object representing the
specified string.
Extends: Object
This class implements an object type wrapper for character
values. Object type wrappers are useful because many Java classes
operate on objects rather than primitive data types.
Member Constants
public final static int MAX_RADIX
This is a constant representing the maximum radix value allowed
for conversion between numbers and strings. This constant is set
to 36.
public final static int MAX_VALUE
This is a constant representing the largest character value supported.
This constant is set to '\uffff'.
public final static int MIN_RADIX
This is a constant representing the minimum radix value allowed
for conversion between numbers and strings. This constant is set
to 2.
public final static int MIN_VALUE
This is a constant representing the smallest character value supported.
This constant is set to '\u0000'.
Character Constructor
public Character(char value)
This constructor creates a character wrapper object
representing the specified primitive character value.
Parameters: value-the
character value to be wrapped.
charValue
public char charValue()
This method determines the primitive character value
represented by this object.
Returns: The character value represented.
digit
public static int digit(char ch, int
radix)
This method determines the numeric value of the specified
character digit using the specified radix.
Parameters:
ch-the character
to be converted to a number.
radix-the radix to use in
the conversion.
Returns: The numeric value of the specified character
digit using the specified radix, or -1
if the character isn't a valid numeric digit.
equals
public boolean equals(Object obj)
This method compares the character value of the specified
object to the character value of this object. The equals
method returns true only
if the specified object is a Character
object representing the same primitive character value as this
object.
Parameters: obj-the
object to compare.
Returns: true
if the specified object is a Character
object representing the same primitive character value as this
object; false otherwise.
forDigit
public static char forDigit(int digit,
int radix)
This method determines the character value of the
specified numeric digit using the specified radix.
Parameters:
digit-the numeric
digit to be converted to a character.
radix-the radix to use in
the conversion.
Returns: The character value of the specified numeric
digit using the specified radix, or 0
if the number isn't a valid character.
hashCode
public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.
isDefined
public static boolean isDefined(char
ch)
This method determines if the specified character
has a defined Unicode meaning. A character is defined if it has
an entry in the Unicode attribute table.
Parameters: ch-the
character to be checked.
Returns: true
if the character has a defined Unicode meaning; false
otherwise.
isDigit
public static boolean isDigit(char ch)
This method determines if the specified character
is a numeric digit. A character is a numeric digit if its Unicode
name contains the word DIGIT.
Parameters: ch-the
character to be checked.
Returns: true
if the character is a numeric digit; false
otherwise.
isJavaLetter
public static boolean isJavaLetter(char
ch)
This method determines if the specified character
is permissible as the leading character in a Java identifier.
A character is considered a Java letter if it is a letter, the
ASCII dollar sign character ($),
or the underscore character (_).
Parameters: ch-the
character to be checked.
Returns: true
if the character is a Java letter; false
otherwise.
isJavaLetterOrDigit
public static boolean isJavaLetterOrDigit(char
ch)
This method determines if the specified character
is permissible as a non-leading character in a Java identifier.
A character is considered a Java letter or digit if it is a letter,
a digit, the ASCII dollar sign character ($),
or the underscore character (_).
Parameters: ch-the
character to be checked.
Returns: true
if the character is a Java letter or digit; false
otherwise.
isLetter
public static boolean isLetter(char ch)
This method determines if the specified character
is a letter.
Parameters: ch-the
character to be checked.
Returns: true
if the character is a letter; false
otherwise.
isLetterOrDigit
public static boolean isLetterOrDigit(char
ch)
This method determines if the specified character
is a letter or digit.
Parameters: ch-the
character to be checked.
Returns: true
if the character is a letter or digit; false
otherwise.
isLowerCase
public static boolean isLowerCase(char
ch)
This method determines if the specified character
is a lowercase character.
Parameters: ch-the
character to be checked.
Returns: true
if the character is a lowercase character; false
otherwise.
isSpace
public static boolean isSpace(char ch)
This method determines if the specified character
is a whitespace character.
Parameters: ch-the
character to be checked.
Returns: true
if the character is a whitespace character; false
otherwise.
isTitleCase
public static boolean isTitleCase(char
ch)
This method determines if the specified character
is a titlecase character. Titlecase characters are those whose
printed representations look like pairs of Latin letters.
Parameters: ch-the
character to be checked.
Returns: true
if the character is a titlecase character; false
otherwise.
isUpperCase
public static boolean isUpperCase(char
ch)
This method determines if the specified character
is an uppercase character.
Parameters: ch-the
character to be checked.
Returns: true
if the character is an uppercase character; false
otherwise.
toLowerCase
public static char toLowerCase(char ch)
This method converts the specified character to a
lowercase character, if the character isn't already lowercase
and a lowercase equivalent exists.
Parameters: ch-the
character to be converted.
Returns: The lowercase equivalent of the specified
character, if one exists; otherwise, the original character.
toString
public String toString()
This method determines a string representation of
the primitive character value for this object; the resulting string
is one character in length.
Returns: A string representing the character value
of this object.
toTitleCase
public static char toTitleCase(char ch)
This method converts the specified character to a
titlecase character, if the character isn't already titlecase
and a titlecase equivalent exists. Titlecase characters are those
whose printed representations look like pairs of Latin letters.
Parameters: ch-the
character to be converted.
Returns: The titlecase equivalent of the specified
character, if one exists; otherwise, the original character.
toUpperCase
public static char toUpperCase(char ch)
This method converts the specified character to an
uppercase character, if the character isn't already uppercase
and an uppercase equivalent exists.
Parameters: ch-the
character to be converted.
Returns: The uppercase equivalent of the specified
character, if one exists; otherwise, the original character.
Extends: Object
This class implements a runtime descriptor for classes
and interfaces in a running Java program. Instances of Class
are automatically constructed by the Java virtual machine when
classes are loaded, which explains why there are no public constructors
for the class.
forName
public static Class forName(String className)
throws ClassNotFoundException
This method determines the runtime class descriptor
for the class with the specified name.
Parameters: className-the
fully qualified name of the desired class.
Returns: The runtime class descriptor for the class
with the specified name.
Throws: ClassNotFoundException
if the class could not be found.
getClassLoader
public ClassLoader getClassLoader()
This method determines the class loader for this object.
Returns: The class loader for this object, or null
if the class wasn't created by a class loader.
getInterfaces
public Class[] getInterfaces()
This method determines the interfaces implemented
by the class or interface represented by this object.
Returns: An array of interfaces implemented by the
class or interface represented by this object, or an array of
length 0 if no interfaces are implemented.
getName
public String getName()
This method determines the fully qualified name of
the class or interface represented by this object.
Returns: The fully qualified name of the class or
interface represented by this object.
getSuperclass
public Class getSuperclass()
This method determines the superclass of the class
represented by this object.
Returns: The superclass of the class represented
by this object, or null if this object represents the Object
class.
isInterface
public boolean isInterface()
This method determines if the class represented by
this object is actually an interface.
Returns: true
if the class is an interface; false
otherwise.
newInstance
public Object newInstance() throws InstantiationException,
IllegalAccessException
This method creates a new default instance of the
class represented by this object.
Returns: A new default instance of the class represented
by this object.
Throws: InstantiationException
if you try to instantiate an abstract class or an interface, or
if the instantiation fails for some other reason.
Throws: IllegalAccessException
if the class is not accessible.
toString
public String toString()
This method determines the name of the class or interface
represented by this object, with the string "class"
or the string "interface"
prepended appropriately.
Returns: The name of the class or interface represented
by this object, with a descriptive string prepended indicating
whether the object represents a class or interface.
Extends: Object
This class is an abstract class that defines a mechanism
for dynamically loading classes into the Java runtime system.
ClassLoader Constructor
protected ClassLoader()
This constructor creates a default class loader. If
a security manager is present, it is checked to see if the current
thread has permission to create the class loader. If not, a SecurityException
is thrown.
Throws: SecurityException
if the current thread doesn't have permission to create the class
loader.
defineClass
protected final Class defineClass(byte
b[], int off, int len)
This method converts an array of bytes into an instance
of class Class by reading
len bytes from the array
b beginning off
bytes into the array.
Parameters:
b-the byte array
containing the class data.
off-the starting offset into
the array for the data.
len-the length in bytes of
the class data.
Returns: A Class
object created from the class data.
Throws: ClassFormatError
if the class data does not define a valid class.
findSystemClass
protected final Class findSystemClass(String
name) throws ClassNotFoundException
This method finds the system class with the specified
name, loading it if necessary. A system class is a class loaded
from the local file system with no class loader in a platform-specific
manner.
Parameters: name-the
name of the system class to find.
Returns: A Class
object representing the system class.
Throws: ClassNotFoundException
if the class is not found.
Throws: NoClassDefFoundError
if a definition for the class is not found.
loadClass
protected abstract Class loadClass(String
name, boolean resolve)
throws ClassNotFoundException
This method loads the class with the specified name,
resolving it if the resolve
parameter is set to true.
This method must be implemented in all derived class loaders,
because it is defined as abstract.
Parameters:
name-the name of
the desired class.
resolve-a boolean value specifying
whether the class is to be resolved; a value of true
means the class is resolved, whereas a value of false
means the class isn't resolved.
Returns: The loaded Class
object, or null if the class isn't found.
Throws: ClassNotFoundException
if the class is not found.
resolveClass
protected final void resolveClass(Class
c)
This method resolves the specified class so that instances
of it can be created or so that its methods can be called.
Parameters: c-the
class to be resolved.
Extends: Object
This class provides the framework for native Java
code compilers and related services. The Java runtime system looks
for a native code compiler on startup, in which case the compiler
is called to compile Java bytecode classes into native code.
command
public static Object command(Object any)
This method performs some compiler-specific operation
based on the type of specified object and its related state.
Parameters: any-the
object to perform an operation based on.
Returns: A compiler-specific value, or null
if no compiler is available.
compileClass
public static boolean compileClass(Class
clazz)
This method compiles the specified class.
Parameters: clazz-the
class to compile.
Returns: true
if the compilation was successful, false
if the compilation failed or if no compiler is available.
compileClasses
public static boolean compileClasses(String
string)
This method compiles all classes whose names match
the specified string name.
Parameters: string-a
string containing the name of the classes to compile.
Returns: true
if the compilation was successful, false
if the compilation failed or if no compiler is available.
disable
public static void disable()
This method disables the compiler.
enable
public static void enable()
This method enables the compiler.
Extends: Number
This class implements an object type wrapper for double
values. Object type wrappers are useful because many Java classes
operate on objects rather than primitive data types.
Member Constants
public final static double MAX_VALUE
This is a constant representing the maximum value allowed for
a double. This constant is set to 1.79769313486231570e+308d.
public final static double MIN_VALUE
This is a constant representing the minimum value allowed for
a double. This constant is set to 4.94065645841246544e-324d.
public final static double NaN
This is a constant representing the not-a-number value for double
types, which is not equal to anything, including itself.
public final static double NEGATIVE_INFINITY
This is a constant representing negative infinity for double types.
public final static double POSITIVE_INFINITY
This is a constant representing positive infinity for double types.
Double Constructor
public Double(double value)
This constructor creates a double wrapper object representing
the specified primitive double value.
Parameters: value-the
double value to be wrapped.
Double Constructor
public Double(String s) throws NumberFormatException
This constructor creates a double wrapper object representing
the specified string. The string is converted to a double using
a similar technique as the valueOf
method.
Parameters: s-the
string representation of a double value to be wrapped.
Throws: NumberFormatException
if the string does not contain a parsable double.
doubleToLongBits
public static long doubleToLongBits(double
value)
This method determines the IEEE 754 floating-point
double precision representation of the specified double value.
The IEEE 754 floating-point double precision format specifies
the following bit layout:
- 63 represents the sign of the number.
- 62-52 represent the exponent of the number.
- 51-0 represent the mantissa of the number.
Parameters: value-the
double value to convert to the IEEE 754 format.
Returns: The IEEE 754 floating-point representation
of the specified double value.
doubleValue
public double doubleValue()
This method determines the primitive double value
represented by this object.
Returns: The double value represented.
equals
public boolean equals(Object obj)
This method compares the double value of the specified
object to the double value of this object. The equals
method only returns true
if the specified object is a Double
object representing the same primitive double value as this object.
Note that to be useful in hash tables, this method considers two
NaN double values to be equal,
even though NaN technically
is not equal to itself.
Parameters: obj-the
object to compare.
Returns: true
if the specified object is a Double
object representing the same primitive double value as this object;
false otherwise.
floatValue
public float floatValue()
This method converts the primitive double value represented
by this object to a float.
Returns: A float conversion of the double value
represented.
hashCode
public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.
intValue
public int intValue()
This method converts the primitive double value represented
by this object to an integer.
Returns: An integer conversion of the double value
represented.
isInfinite
public boolean isInfinite()
This method determines if the primitive double value
represented by this object is positive or negative infinity.
Returns: true
if the double value is positive or negative infinity; false
otherwise.
isInfinite
public static boolean isInfinite(double
v)
This method determines if the specified double value
is positive or negative infinity.
Parameters: v-the
double value to be checked.
Returns: true
if the double value is positive or negative infinity; false
otherwise.
isNaN
public boolean isNaN()
This method determines if the primitive double value
represented by this object is not a number (NaN).
Returns: true
if the double value is not a number; false
otherwise.
isNaN
public static boolean isNaN(double v)
This method determines if the specified double value
is not a number (NaN).
Parameters: v-the
double value to be checked.
Returns: true
if the double value is not a number; false
otherwise.
longBitsToDouble
public static double longBitsToDouble(long
bits)
This method determines the double representation of
the specified IEEE 754 floating-point double precision value.
The IEEE 754 floating-point double precision format specifies
the following bit layout:
- 63 represents the sign of the number.
- 62-52 represent the exponent of the number.
- 51-0 represent the mantissa of the number.
Parameters: bits-the
IEEE 754 floating-point value to convert to a double.
Returns: The double representation of the specified
IEEE 754 floating-point value.
longValue
public long longValue()
This method converts the primitive double value represented
by this object to a long.
Returns: A long conversion of the double value represented.
toString
public String toString()
This method determines a string representation of
the primitive double value for this object.
Returns: A string representing the double value
of this object.
toString
public static String toString(double
d)
This method determines a string representation of
the specified double value.
Parameters: d-the
double value to be converted.
Returns: A string representing the specified double
value.
valueOf
public static Double valueOf(String s)
throws NumberFormatException
This method creates a new double wrapper object based
on the double value represented by the specified string.
Parameters: s-the
string representation of a double value to be wrapped.
Returns: A double wrapper object representing the
specified string.
Throws: NumberFormatException
if the string does not contain a parsable double.
Extends: Number
This class implements an object type wrapper for float
values. Object type wrappers are useful because many Java classes
operate on objects rather than primitive data types.
Member Constants
public final static float MAX_VALUE
This is a constant representing the maximum value allowed for
a float. This constant is set to 3.40282346638528860e+38.
public final static float MIN_VALUE
This is a constant representing the minimum value allowed for
a float. This constant is set to 1.40129846432481707e-45.
public final static float NaN
This is a constant representing the not-a-number value for float
types, which is not equal to anything, including itself.
public final static float NEGATIVE_INFINITY
This is a constant representing negative infinity for float types.
public final static float POSITIVE_INFINITY
This is a constant representing positive infinity for float types.
Float Constructor
public Float(double value)
This constructor creates a float wrapper object representing
the specified primitive double value.
Parameters: value-the
double value to be wrapped.
Float Constructor
public Float(float value)
This constructor creates a float wrapper object representing
the specified primitive float value.
Parameters: value-the
float value to be wrapped.
Float Constructor
public Float(String s) throws NumberFormatException
This constructor creates a float wrapper object representing
the specified string. The string is converted to a float using
a similar technique as the valueOf
method.
Parameters: s-the
string representation of a float value to be wrapped.
Throws: NumberFormatException
if the string does not contain a parsable float.
doubleValue
public double doubleValue()
This method converts the primitive float value represented
by this object to a double.
Returns: A double conversion of the float value
represented.
equals
public boolean equals(Object obj)
This method compares the float value of the specified
object to the float value of this object. The equals
method only returns true
if the specified object is a Float
object representing the same primitive float value as this object.
Note that to be useful in hash tables, this method considers two
NaN float values to be equal,
even though NaN technically
is not equal to itself.
Parameters: obj-the
object to compare.
Returns: true
if the specified object is a Float
object representing the same primitive float value as this object;
false otherwise.
floatToIntBits
public static int floatToIntBits(float
value)
This method determines the IEEE 754 floating-point
single precision representation of the specified float value.
The IEEE 754 floating-point single precision format specifies
the following bit layout:
- 31 represents the sign of the number.
- 30-23 represent the exponent of the number.
- 22-0 represent the mantissa of the number.
Parameters: value-the
float value to convert to the IEEE 754 format.
Returns: The IEEE 754 floating-point representation
of the specified float value.
floatValue
public float floatValue()
This method determines the primitive float value represented
by this object.
Returns: The float value represented.
hashCode
public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.
intBitsToFloat
public static float intBitsToFloat(int
bits)
This method determines the float representation of
the specified IEEE 754 floating-point single precision value.
The IEEE 754 floating-point single precision format specifies
the following bit layout:
- 31 represents the sign of the number.
- 30-23 represent the exponent of the number.
- 22-0 represent the mantissa of the number.
Parameters: bits-the
IEEE 754 floating-point value to convert to a float.
Returns: The float representation of the specified
IEEE 754 floating-point value.
intValue
public int intValue()
This method converts the primitive float value represented
by this object to an integer.
Returns: An integer conversion of the float value
represented.
isInfinite
public boolean isInfinite()
This method determines if the primitive float value
represented by this object is positive or negative infinity.
Returns: true
if the float value is positive or negative infinity; false
otherwise.
isInfinite
public static boolean isInfinite(float
v)
This method determines if the specified float value
is positive or negative infinity.
Parameters: v-the
float value to be checked.
Returns: true
if the float value is positive or negative infinity; false
otherwise.
isNaN
public boolean isNaN()
This method determines if the primitive float value
represented by this object is not a number (NaN).
Returns: true
if the float value is not a number; false
otherwise.
isNaN
public static boolean isNaN(float v)
This method determines if the specified float value
is not a number (NaN).
Parameters: v-the
float value to be checked.
Returns: true
if the float value is not a number; false
otherwise.
longValue
public long longValue()
This method converts the primitive float value represented
by this object to a long.
Returns: A long conversion of the float value represented.
toString
public String toString()
This method determines a string representation of
the primitive float value for this object.
Returns: A string representing the float value of
this object.
toString
public static String toString(float f)
This method determines a string representation of
the specified float value.
Parameters: f-the
float value to be converted.
Returns: A string representing the specified float
value.
valueOf
public static Float valueOf(String s)
throws NumberFormatException
This method creates a new float wrapper object based
on the float value represented by the specified string.
Parameters: s-the
string representation of a float value to be wrapped.
Returns: A float wrapper object representing the
specified string.
Throws: NumberFormatException
if the string does not contain a parsable float.
Extends: Number
This class implements an object type wrapper for integer
values. Object type wrappers are useful because many Java classes
operate on objects rather than primitive data types.
Member Constants
public final static int MAX_VALUE
This is a constant representing the maximum value
allowed for an integer. This constant is set to 0x7fffffff.
public final static int MIN_VALUE
This is a constant representing the minimum value
allowed for an integer. This constant is set to 0x80000000.
Integer Constructor
public Integer(int value)
This constructor creates an integer wrapper object
representing the specified primitive integer value.
Parameters: value-the
integer value to be wrapped.
Integer Constructor
public Integer(String s) throws NumberFormatException
This constructor creates an integer wrapper object
representing the specified string. The string is converted to
an integer using a similar technique as the valueOf
method.
Parameters: s-the
string representation of an integer value to be wrapped.
Throws: NumberFormatException
if the string does not contain a parsable integer.
doubleValue
public double doubleValue()
This method converts the primitive integer value represented
by this object to a double.
Returns: A double conversion of the integer value
represented.
equals
public boolean equals(Object obj)
This method compares the integer value of the specified
object to the integer value of this object. The equals
method returns true only
if the specified object is an Integer
object representing the same primitive integer value as this object.
Parameters: obj-the
object to compare.
Returns: true
if the specified object is an Integer
object representing the same primitive integer value as this object;
false otherwise.
floatValue
public float floatValue()
This method converts the primitive integer value represented
by this object to a float.
Returns: A float conversion of the integer value
represented.
getInteger
public static Integer getInteger(String
name)
This method determines an Integer
object representing the value of the system property with the
specified name. If the system property doesn't exist, null is
returned.
Parameters: name-the
system property name to check the integer value of.
Returns: An Integer
object representing the value of the specified system property,
or null if the property doesn't exist.
getInteger
public static Integer getInteger(String
name, int val)
This method determines an Integer
object representing the value of the system property with the
specified name. If the system property doesn't exist, an Integer
object representing the specified default property value is returned.
Parameters: name-the
system property name to check the integer value of.
Parameters: val-the
default integer property value.
Returns: An Integer
object representing the value of the specified system property,
or an Integer object representing
val if the property doesn't
exist.
getInteger
public static Integer getInteger(String
name, Integer val)
This method determines an Integer
object representing the value of the system property with the
specified name. In addition, this version of getInteger
includes support for reading hexadecimal and octal property values.
If the system property doesn't exist, the specified default property
value is returned.
Parameters:
name-the system property
name to check the integer value of.
val-the default integer property
value object.
Returns: An Integer
object representing the value of the specified system property,
or val if the property doesn't
exist.
hashCode
public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.
intValue
public int intValue()
This method determines the primitive integer value
represented by this object.
Returns: The integer value represented.
longValue
public long longValue()
This method converts the primitive integer value represented
by this object to a long.
Returns: A long conversion of the integer value
represented.
parseInt
public static int parseInt(String s)
throws NumberFormatException
This method parses a signed decimal integer value
from the specified string. Note that all the characters in the
string must be decimal digits, with the exception that the first
character can be a minus character (-)
to denote a negative number.
Parameters: s-the
string representation of an integer value.
Returns: The integer value represented by the specified
string.
Throws: NumberFormatException
if the string does not contain a parsable integer.
parseInt
public static int parseInt(String s,
int radix) throws NumberFormatException
This method parses a signed integer value in the specified
radix from the specified string. Note that all the characters
in the string must be digits in the specified radix, with the
exception that the first character can be a minus character (-)
to denote a negative number.
Parameters:
s-the string representation
of an integer value.
radix-the radix to use for
the integer.
Returns: The integer value represented by the specified
string.
Throws: NumberFormatException
if the string does not contain a parsable integer.
toBinaryString
public static String toBinaryString(int
i)
This method determines a string representation of
the specified unsigned base 2 integer value.
Parameters: i-the
unsigned base 2 integer value to be converted.
Returns: A string representing the specified unsigned
base 2 integer value.
toHexString
public static String toHexString(int
i)
This method determines a string representation of
the specified unsigned base 16 integer value.
Parameters: i-the
unsigned base 16 integer value to be converted.
Returns: A string representing the specified unsigned
base 16 integer value.
toOctalString
public static String toOctalString(int
i)
This method determines a string representation of
the specified unsigned base 8 integer value.
Parameters: i-the
unsigned base 8 integer value to be converted.
Returns: A string representing the specified unsigned
base 8 integer value.
toString
public String toString()
This method determines a string representation of
the primitive decimal integer value for this object.
Returns: A string representing the decimal integer
value of this object.
toString
public static String toString(int i)
This method determines a string representation of
the specified decimal integer value.
Parameters: i-the
decimal integer value to be converted.
Returns: A string representing the specified decimal
integer value.
toString
public static String toString(int i,
int radix)
This method determines a string representation of
the specified integer value in the specified radix.
Parameters:
i-the integer value
to be converted.
radix-the radix to use for
the conversion.
Returns: A string representing the specified integer
value in the specified radix.
valueOf
public static Integer valueOf(String
s) throws NumberFormatException
This method creates a new integer wrapper object based
on the decimal integer value represented by the specified string.
Parameters: s-the
string representation of a decimal integer value to be wrapped.
Returns: An integer wrapper object representing
the specified string.
Throws: NumberFormatException
if the string does not contain a parsable integer.
valueOf
public static Integer valueOf(String
s, int radix) throws NumberFormatException
This method creates a new integer wrapper object based
on the integer value in the specified radix represented by the
specified string.
Parameters:
s-the string representation
of an integer value to be wrapped.
radix-the radix to use for
the integer.
Returns: An integer wrapper object in the specified
radix representing the specified string.
Throws: NumberFormatException
if the string does not contain a parsable integer.
Extends: Number
This class implements an object type wrapper for long
values. Object type wrappers are useful because many Java classes
operate on objects rather than primitive data types.
Member Constants
public final static int MAX_VALUE
This is a constant representing the maximum value allowed for
a long. This constant is set to 0x7fffffffffffffff.
public final static int MIN_VALUE
This is a constant representing the minimum value allowed for
a long. This constant is set to 0x8000000000000000.
Long Constructor
public Long(long value)
This constructor creates a long wrapper object representing
the specified primitive long value.
Parameters: value-the
long value to be wrapped.
Long Constructor
public Long(String s) throws NumberFormatException
This constructor creates a long wrapper object representing
the specified string. The string is converted to a long using
a similar technique as the valueOf
method.
Parameters: s-the
string representation of a long value to be wrapped.
Throws: NumberFormatException
if the string does not contain a parsable long.
doubleValue
public double doubleValue()
This method converts the primitive long value represented
by this object to a double.
Returns: A double conversion of the long value represented.
equals
public boolean equals(Object obj)
This method compares the long value of the specified
object to the long value of this object. The equals
method returns true only
if the specified object is a Long
object representing the same primitive long value as this object.
Parameters: obj-the
object to compare.
Returns: true
if the specified object is a Long
object representing the same primitive long value as this object;
false otherwise.
floatValue
public float floatValue()
This method converts the primitive long value represented
by this object to a float.
Returns: A float conversion of the long value represented.
getLong
public static Long getLong(String name)
This method determines a Long
object representing the value of the system property with the
specified name. If the system property doesn't exist, null is
returned.
Parameters: name-the
system property name to check the long value of.
Returns: A Long
object representing the value of the specified system property,
or null if the property doesn't exist.
getLong
public static Long getLong(String name,
long val)
This method determines a Long
object representing the value of the system property with the
specified name. If the system property doesn't exist, a Long
object representing the specified default property value is returned.
Parameters: name-the
system property name to check the long value of.
Parameters: val-the
default long property value.
Returns: A Long
object representing the value of the specified system property,
or a long object representing val
if the property doesn't exist.
getLong
public static Long getLong(String name,
Long val)
This method determines a Long
object representing the value of the system property with the
specified name. In addition, this version of getLong
includes support for reading hexadecimal and octal property values.
If the system property doesn't exist, the specified default property
value is returned.
Parameters:
name-the system property
name to check the long value of.
val-the default long property
value object.
Returns: A Long
object representing the value of the specified system property,
or val if the property doesn't
exist.
hashCode
public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.
intValue
public int intValue()
This method converts the primitive long value represented
by this object to an integer.
Returns: An integer conversion of the long value
represented.
longValue
public long longValue()
This method determines the primitive long value represented
by this object.
Returns: The long value represented.
parseLong
public static long parseLong(String s)
throws NumberFormatException
This method parses a signed decimal long value from
the specified string. Note that all the characters in the string
must be decimal digits, with the exception that the first character
can be a minus character (-)
to denote a negative number.
Parameters: s-the
string representation of a long value.
Returns: The long value represented by the specified
string.
Throws: NumberFormatException
if the string does not contain a parsable long.
parseLong
public static long parseLong(String s,
int radix) throws NumberFormatException
This method parses a signed long value in the specified
radix from the specified string. Note that all the characters
in the string must be digits in the specified radix, with the
exception that the first character can be a minus character (-)
to denote a negative number.
Parameters:
s-the string representation
of a long value.
radix-the radix to use for
the long.
Returns: The long value represented by the specified
string.
Throws: NumberFormatException
if the string does not contain a parsable long.
toBinaryString
public static String toBinaryString(long
l)
This method determines a string representation of
the specified unsigned base 2 long value.
Parameters: l-the
unsigned base 2 long value to be converted.
Returns: A string representing the specified unsigned
base 2 long value.
toHexString
public static String toHexString(long
l)
This method determines a string representation of
the specified unsigned base 16 long value.
Parameters: l-the
unsigned base 16 long value to be converted.
Returns: A string representing the specified unsigned
base 16 long value.
toOctalString
public static String toOctalString(long
l)
This method determines a string representation of
the specified unsigned base 8 long value.
Parameters: l-the
unsigned base 8 long value to be converted.
Returns: A string representing the specified unsigned
base 8 long value.
toString
public String toString()
This method determines a string representation of
the primitive decimal long value for this object.
Returns: A string representing the decimal long
value of this object.
toString
public static String toString(long l)
This method determines a string representation of
the specified decimal long value.
Parameters: l-the
decimal long value to be converted.
Returns: A string representing the specified decimal
long value.
toString
public static String toString(long l,
int radix)
This method determines a string representation of
the specified long value in the specified radix.
Parameters:
i-the long value
to be converted.
radix-the radix to use for
the conversion.
Returns: A string representing the specified long
value in the specified radix.
valueOf
public static Long valueOf(String s)
throws NumberFormatException
This method creates a new long wrapper object based
on the decimal long value represented by the specified string.
Parameters: s-the
string representation of a decimal long value to be wrapped.
Returns: A long wrapper object representing the
specified string.
Throws: NumberFormatException
if the string does not contain a parsable long.
valueOf
public static Long valueOf(String s,
int radix) throws NumberFormatException
This method creates a new long wrapper object based
on the long value in the specified radix represented by the specified
string.
Parameters:
s-the string representation
of a long value to be wrapped.
radix-the radix to use for
the long.
Returns: A long wrapper object in the specified
radix representing the specified string.
Throws: NumberFormatException
if the string does not contain a parsable long.
Extends: Object
This class implements a library of common math functions,
including methods for performing basic numerical operations such
as elementary exponential, logarithm, square root, and trigonometric
functions.
Member Constants
public final static double E
This is a constant representing the double value of E,
which is the base of the natural logarithms. This constant is
set to 2.7182818284590452354.
public final static double PI
This is a constant representing the double value of PI,
which is the ratio of the circumference of a circle to its diameter.
This constant is set to 3.14159265358979323846.
abs
public static double abs(double a)
This method calculates the absolute value of the specified
double value.
Parameters: a-the
double value to calculate the absolute value of.
Returns: The absolute value of the double value.
abs
public static float abs(float a)
This method calculates the absolute value of the specified
float value.
Parameters: a-the
float value to calculate the absolute value of.
Returns: The absolute value of the float value.
abs
public static int abs(int a)
This method calculates the absolute value of the specified
integer value.
Parameters: a-the
integer value to calculate the absolute value of.
Returns: The absolute value of the integer value.
abs
public static long abs(long a)
This method calculates the absolute value of the specified
long value.
Parameters: a-the
long value to calculate the absolute value of.
Returns: The absolute value of the long value.
acos
public static double acos(double a)
This method calculates the arc cosine of the specified
double value.
Parameters: a-the
double value to calculate the arc cosine of.
Returns: The arc cosine of the double value.
asin
public static double asin(double a)
This method calculates the arc sine of the specified
double value.
Parameters: a-the
double value to calculate the arc sine of.
Returns: The arc sine of the double value.
atan
public static double atan(double a)
This method calculates the arc tangent of the specified
double value.
Parameters: a-the
double value to calculate the arc tangent of.
Returns: The arc tangent of the double value.
atan2
public static double atan2(double x,
double y)
This method calculates the theta component of the
polar coordinate (r,theta) corresponding to the rectangular coordinate
(x y) specified by the double values.
Parameters:
x-the x component
value of the rectangular coordinate.
y-the y component value of
the rectangular coordinate.
Returns: The theta component of the polar coordinate
corresponding to the rectangular coordinate specified by the double
values.
ceil
public static double ceil(double a)
This method determines the smallest double whole number
that is greater than or equal to the specified double value.
Parameters: a-the
double value to calculate the ceiling of.
Returns: The smallest double whole number that is
greater than or equal to the specified double value.
cos
public static double cos(double a)
This method calculates the cosine of the specified
double value, which is specified in radians.
Parameters: a-the
double value to calculate the cosine of, in radians.
Returns: The cosine of the double value.
exp
public static double exp(double a)
This method calculates the exponential value of the
specified double value, which is E raised to the power of a.
Parameters: a-the
double value to calculate the exponential value of.
Returns: The exponential value of the specified
double value.
floor
public static double floor(double a)
This method determines the largest double whole number
that is less than or equal to the specified double value.
Parameters: a-the
double value to calculate the floor of.
Returns: The largest double whole number that is
less than or equal to the specified double value.
IEEEremainder
public static double IEEEremainder(double
f1, double f2)
This method calculates the remainder of f1
divided by f2 as defined
by the IEEE 754 standard.
Parameters:
f1-the dividend for
the division operation.
f2-the divisor for the division
operation.
Returns: The remainder of f1
divided by f2 as defined
by the IEEE 754 standard.
log
public static double log(double a) throws
ArithmeticException
This method calculates the natural logarithm (base
E) of the specified double value.
Parameters: a-the
double value, which is greater than 0.0, to calculate the natural
logarithm of.
Returns: The natural logarithm of the specified
double value.
Throws: ArithmeticException
if the specified double value is less than 0.0.
max
public static double max(double a, double
b)
This method determines the larger of the two specified
double values.
Parameters:
a-the first double
value to be compared.
b-the second double value
to be compared.
Returns: The larger of the two specified double
values.
max
public static float max(float a, float
b)
This method determines the larger of the two specified
float values.
Parameters:
a-the first float
value to be compared.
b-the second float value
to be compared.
Returns: The larger of the two specified float values.
max
public static int max(int a, int b)
This method determines the larger of the two specified
integer values.
Parameters:
a-the first integer
value to be compared.
b-the second integer value
to be compared.
Returns: The larger of the two specified integer
values.
max
public static long max(long a, long b)
This method determines the larger of the two specified
long values.
Parameters:
a-the first long
value to be compared.
b-the second long value to
be compared.
Returns: The larger of the two specified long values.
min
public static double min(double a, double
b)
This method determines the smaller of the two specified
double values.
Parameters:
a-the first double
value to be compared.
b-the second double value
to be compared.
Returns: The smaller of the two specified double
values.
min
public static float min(float a, float
b)
This method determines the smaller of the two specified
float values.
Parameters:
a-the first float
value to be compared.
b-the second float value
to be compared.
Returns: The smaller of the two specified float
values.
min
public static int min(int a, int b)
This method determines the smaller of the two specified
integer values.
Parameters:
a-the first integer
value to be compared.
b-the second integer value
to be compared.
Returns: The smaller of the two specified integer
values.
min
public static long min(long a, long b)
This method determines the smaller of the two specified
long values.
Parameters:
a-the first long
value to be compared.
b-the second long value to
be compared.
Returns: The smaller of the two specified long values.
pow
public static double pow(double a, double
b) throws ArithmeticException
This method calculates the double value a
raised to the power of b.
Parameters:
a-a double value
to be raised to a power specified by b.
b-the power to raise a
to.
Returns: The double value a
raised to the power of b.
Throws: ArithmeticException
if a equals 0.0 and b
is less than or equal to 0.0, or if a
is less than or equal to 0.0 and b
is not a whole number.
random
public static double random()
This method generates a pseudo-random double between
0.0 and 1.0.
Returns: A pseudo-random double between 0.0 and
1.0.
rint
public static double rint(double a)
This method determines the closest whole number to
the specified double value. If the double value is equally spaced
between two whole numbers, rint
will return the even number.
Parameters: a-the
double value to determine the closest whole number.
Returns: The closest whole number to the specified
double value.
round
public static long round(double a)
This method rounds off the specified double value
by determining the closest long value.
Parameters: a-the
double value to round off.
Returns: The closest long value to the specified
double value.
round
public static int round(float a)
This method rounds off the specified float value by
determining the closest integer value.
Parameters: a-the
float value to round off.
Returns: The closest integer value to the specified
float value.
sin
public static double sin(double a)
This method calculates the sine of the specified double
value, which is specified in radians.
Parameters: a-the
double value to calculate the sine of, in radians.
Returns: The sine of the double value.
sqrt
public static double sqrt(double a) throws
ArithmeticException
This method calculates the square root of the specified
double value.
Parameters: a-the
double value, which is greater than 0.0, to calculate the square
root for.
Returns: The square root of the double value.
Throws: ArithmeticException
if the specified double value is less than 0.0.
tan
public static double tan(double a)
This method calculates the tangent of the specified
double value, which is specified in radians.
Parameters: a-the
double value to calculate the tangent of, in radians.
Returns: The tangent of the double value.
Extends: Object
This class is an abstract class that provides the
basic functionality required of a numeric object. All specific
numeric objects are derived from Number.
doubleValue
public abstract double doubleValue()
This method determines the primitive double value
represented by this object. Note that this may involve rounding
if the number is not already a double.
Returns: The double value represented.
floatValue
public abstract float floatValue()
This method determines the primitive float value represented
by this object. Note that this may involve rounding if the number
is not already a float.
Returns: The float value represented.
intValue
public abstract int intValue()
This method determines the primitive integer value
represented by this object.
Returns: The integer value represented.
longValue
public abstract long longValue()
This method determines the primitive long value represented
by this object.
Returns: The long value represented.
This class is the root of the Java class hierarchy, providing
the core functionality required of all objects. All classes have
Object as a superclass, and
all classes implement the methods defined in Object.
Object Constructor
public Object()
This constructor creates a default object.
clone
protected Object clone() throws CloneNotSupportedException
This method creates a clone of this object by creating
a new instance of the class and copying each of the member variables
of this object to the new object. To be cloneable, derived classes
must implement the Cloneable
interface.
Returns: A clone of this object.
Throws: OutOfMemoryError
if there is not enough memory.
Throws: CloneNotSupportedException
if the object doesn't support the Cloneable
interface or if it explicitly doesn't want to be cloned.
equals
public boolean equals(Object obj)
This method compares this object with the specified
object for equality. The equals
method is used by the Hashtable
class to compare objects stored in the hash table.
Parameters: obj-the
object to compare.
Returns: true
if this object is equivalent to the specified object; false
otherwise.
finalize
protected void finalize() throws Throwable
This method is called by the Java garbage collector
when an object is being destroyed. The default behavior of finalize
is to do nothing. Derived classes can override finalize
to include cleanup code that is to be executed when the object
is destroyed.
getClass
public final Class getClass()
This method determines the runtime class descriptor
for this object.
Returns: The runtime class descriptor for this object.
hashCode
public int hashCode()
This method calculates a hash code for this object,
which is a unique integer identifying the object. Hash codes are
used by the Hashtable class.
Returns: A hash code for this object.
notify
public final void notify()
This method wakes up a single thread that is waiting
on this object's monitor. A thread is set to wait on an object's
monitor when the wait method
is called. The notify method
should only be called by a thread that is the owner of this object's
monitor. Note that the notify
method can only be called from within a synchronized method.
Throws: IllegalMonitorStateException
if the current thread is not the owner of this object's monitor.
notifyAll
public final void notifyAll()
This method wakes up all threads that are waiting
on this object's monitor. A thread is set to wait on an object's
monitor when the wait method
is called. The notifyAll
method should only be called by a thread that is the owner of
this object's monitor. Note that the notifyAll
method can only be called from within a synchronized method.
Throws: IllegalMonitorStateException
if the current thread is not the owner of this object's monitor.
toString
public String toString()
This method determines a string representation of
this object. It is recommended that all derived classes override
toString.
Returns: A string representing this object.
wait
public final void wait() throws InterruptedException
This method causes the current thread to wait forever
until it is notified via a call to the notify
or notifyAll methods. The
wait method should only be
called by a thread that is the owner of this object's monitor.
Note that the wait method
can only be called from within a synchronized method.
Throws: IllegalMonitorStateException
if the current thread is not the owner of this object's monitor.
Throws: InterruptedException
if another thread has interrupted this thread.
wait
public final void wait(long timeout)
throws InterruptedException
This method causes the current thread to wait until
it is notified via a call to the notify
or notifyAll method, or until
the specified timeout period has elapsed. The wait
method should only be called by a thread that is the owner of
this object's monitor. Note that the wait
method can only be called from within a synchronized method.
Parameters: timeout-the
maximum timeout period to wait, in milliseconds.
Throws: IllegalMonitorStateException
if the current thread is not the owner of this object's monitor.
Throws: InterruptedException
if another thread has interrupted this thread.
wait
public final void wait(long timeout,
int nanos) throws InterruptedException
This method causes the current thread to wait until
it is notified via a call to the notify
or notifyAll method, or until
the specified timeout period has elapsed. The timeout period in
this case is the addition of the timeout
and nanos parameters, which
provide finer control over the timeout period. The wait
method should only be called by a thread that is the owner of
this object's monitor. Note that the wait
method can only be called from within a synchronized method.
Parameters:
timeout-the maximum
timeout period to wait, in milliseconds.
nanos-the additional time
for the timeout period, in nanoseconds.
Throws: IllegalMonitorStateException
if the current thread is not the owner of this object's monitor.
Throws: InterruptedException
if another thread has interrupted this thread.
Extends: Object
This class is an abstract class that provides the
basic functionality required of a system process. Derived Process
objects (subprocesses) are returned from the exec
methods defined in the Runtime
class.
Process Constructor
public Process()
This constructor creates a default process.
destroy
public abstract void destroy()
This method kills the subprocess.
exitValue
public abstract int exitValue()
This method determines the exit value of the subprocess.
Returns: The integer exit value for the subprocess.
Throws: IllegalThreadStateException
if the subprocess has not yet terminated.
getErrorStream
public abstract InputStream getErrorStream()
This method determines the error stream associated
with the subprocess.
Returns: The error stream associated with the subprocess.
getInputStream
public abstract InputStream getInputStream()
This method determines the input stream associated
with the subprocess.
Returns: The input stream associated with the subprocess.
getOutputStream
public abstract OutputStream getOutputStream()
This method determines the output stream associated
with the subprocess.
Returns: The output stream associated with the subprocess.
waitFor
public abstract int waitFor() throws
InterruptedException
This method waits for the subprocess to finish executing.
When the subprocess finishes executing, the integer exit value
is returned.
Returns: The integer exit value for the subprocess.
Throws: InterruptedException
if another thread has interrupted this thread.
Extends: Object
This class provides a mechanism for interacting with
the Java runtime environment. Each running Java application has
access to a single instance of the Runtime class, which it can
use to query and modify the runtime environment.
exec
public Process exec(String command) throws
IOException
This method executes the system command represented
by the specified string in a separate subprocess.
Parameters: command-a
string representing the system command to execute.
Returns: The subprocess that is executing the system
command.
Throws: SecurityException
if the current thread cannot create the subprocess.
exec
public Process exec(String command, String
envp[]) throws IOException
This method executes the system command represented
by the specified string in a separate subprocess with the specified
environment.
Parameters:
command-a string
representing the system command to execute.
envp-an array of strings
representing the environment.
Returns: The subprocess that is executing the system
command.
Throws: SecurityException
if the current thread cannot create the subprocess.
exec
public Process exec(String cmdarray[])
throws IOException
This method executes the system command with arguments
represented by the specified string array in a separate subprocess.
Parameters: cmdarray-an
array of strings representing the system command to execute along
with its arguments.
Returns: The subprocess that is executing the system
command.
Throws: SecurityException
if the current thread cannot create the subprocess.
exec
public Process exec(String cmdarray[],
String envp[]) throws IOException
This method executes the system command with arguments
represented by the specified string array in a separate subprocess
with the specified environment.
Parameters:
cmdarray-an array
of strings representing the system command to execute along with
its arguments.
envp-an array of strings
representing the environment.
Returns: The subprocess that is executing the system
command.
Throws: SecurityException
if the current thread cannot create the subprocess.
exit
public void exit(int status)
This method exits the Java runtime system (virtual
machine) with the specified integer exit status. Note that since
exit kills the runtime system,
it never returns.
Parameters: status-the
integer exit status; this should be set to nonzero if this is
an abnormal exit.
Throws: SecurityException
if the current thread cannot exit with the specified exit status.
freeMemory
public long freeMemory()
This method determines the approximate amount of free
memory available in the runtime system, in bytes.
Returns: Approximate amount of free memory available,
in bytes.
gc
public void gc()
This method invokes the Java garbage collector to
clean up any objects that are no longer needed, usually resulting
in more free memory.
getLocalizedInputStream
public InputStream getLocalizedInputStream(InputStream
in)
This method creates a localized input stream based
on the specified input stream. A localized input stream is a stream
whose local characters are mapped to Unicode characters as they
are read.
Parameters: in-the
input stream to localize.
Returns: A localized input stream based on the specified
input stream.
getLocalizedOutputStream
public OutputStream getLocalizedOutputStream(OutputStream
out)
This method creates a localized output stream based
on the specified output stream. A localized output stream is a
stream whose Unicode characters are mapped to local characters
as they are written.
Parameters: out-the
output stream to localize.
Returns: A localized output stream based on the
specified output stream.
getRuntime
public static Runtime getRuntime()
This method gets the runtime environment object associated
with the current Java program.
Returns: The runtime environment object associated
with the current Java program.
load
public void load(String pathname)
This method loads the dynamic library with the specified
complete pathname.
Parameters: pathname-the
path name of the library to load.
Throws: UnsatisfiedLinkError
if the library doesn't exist.
Throws: SecurityException
if the current thread can't load the library.
loadLibrary
public void loadLibrary(String libname)
This method loads the dynamic library with the specified
library name. Note that the mapping from library name to a specific
filename is performed in a platform-specific manner.
Parameters: libname-the
name of the library to load.
Throws: UnsatisfiedLinkError
if the library doesn't exist.
Throws: SecurityException
if the current thread can't load the library.
runFinalization
public void runFinalization()
This method explicitly causes the finalize
methods of any discarded objects to be called.
totalMemory
public long totalMemory()
This method determines the total amount of memory
in the runtime system, in bytes.
Returns: The total amount of memory, in bytes.
traceInstructions
public void traceInstructions(boolean
on)
This method is used to determine whether the Java
virtual machine prints out a detailed trace of each instruction
executed.
Parameters: on-a
boolean value specifying whether the Java virtual machine prints
out a detailed trace of each instruction executed; a value of
true means the instruction
trace is printed, whereas a value of false
means the instruction trace isn't printed.
traceMethodCalls
public void traceMethodCalls(boolean
on)
This method is used to determine whether the Java
virtual machine prints out a detailed trace of each method that
is called.
Parameters: on-a
boolean value specifying whether the Java virtual machine prints
out a detailed trace of each method that is called; a value of
true means the method call
trace is printed, whereas a value of false
means the method call trace isn't printed.
Extends: Object
This class is an abstract class that defines a security
policy that can be used by Java programs to check for potentially
unsafe operations.
Member Variables
protected boolean inCheck
This member variable specifies whether a security
check is in progress. A value of true
indicates that a security check is in progress, where a value
of false means no check is
taking place.
SecurityManager Constructor
protected SecurityManager()
This constructor creates a default security manager.
Note that only one security manager is allowed for each Java program.
Throws: SecurityException
if the security manager cannot be created.
checkAccept
public void checkAccept(String host,
int port)
This method checks to see if the calling thread is
allowed to establish a socket connection to the specified port
on the specified host.
Parameters:
host-the host name
to connect the socket to.
port-the number of the port
to connect the socket to.
Throws: SecurityException
if the calling thread doesn't have permission to establish the
socket connection.
checkAccess
public void checkAccess(Thread g)
This method checks to see if the calling thread is
allowed access to the specified thread.
Parameters: g-the
thread to check for access.
Throws: SecurityException
if the calling thread doesn't have access to the specified thread.
checkAccess
public void checkAccess(ThreadGroup g)
This method checks to see if the calling thread is
allowed access to the specified thread group.
Parameters: g-the
thread group to check for access.
Throws: SecurityException
if the calling thread doesn't have access to the specified thread
group.
checkConnect
public void checkConnect(String host,
int port)
This method checks to see if the calling thread has
established a socket connection to the specified port on the specified
host.
Parameters:
host-the host name
to check the connection for.
port-the number of the port
to check the connection for.
Throws: SecurityException
if the calling thread doesn't have permission to establish the
socket connection.
checkConnect
public void checkConnect(String host,
int port, Object context)
This method checks to see if the specified security
context has established a socket connection to the specified port
on the specified host.
Parameters:
host-the host name
to check the connection for.
port-the number of the port
to check the connection for.
context-the
security context for the check.
Throws: SecurityException
if the specified security context doesn't have permission to establish
the socket connection.
checkCreateClassLoader
public void checkCreateClassLoader()
This method checks to see if the calling thread is
allowed access to create a new class loader.
Throws: SecurityException
if the calling thread doesn't have permission to create a new
class loader.
checkDelete
public void checkDelete(String file)
This method checks to see if the calling thread is
allowed access to delete the file with the specified platform-specific
filename.
Parameters: file-the
platform-specific filename for the file to be checked.
Throws: SecurityException
if the calling thread doesn't have permission to delete the file.
checkExec
public void checkExec(String cmd)
This method checks to see if the calling thread is
allowed access to create a subprocess to execute the specified
system command.
Parameters: cmd-a
string representing the system command to be checked.
Throws: SecurityException
if the calling thread doesn't have permission to create a subprocess
to execute the system command.
checkExit
public void checkExit(int status)
This method checks to see if the calling thread is
allowed access to exit the Java runtime system with the specified
exit status.
Parameters: status-the
integer exit status to be checked.
Throws: SecurityException
if the calling thread doesn't have permission to exit with the
specified exit status.
checkLink
public void checkLink(String libname)
This method checks to see if the calling thread is
allowed access to dynamically link the library with the specified
name.
Parameters: libname-the
name of the library to be checked.
Throws: SecurityException
if the calling thread doesn't have permission to dynamically link
the library.
checkListen
public void checkListen(int port)
This method checks to see if the calling thread is
allowed to wait for a connection request on the specified port.
Parameters: port-the
number of the port to check the connection for.
Throws: SecurityException
if the calling thread doesn't have permission to wait for a connection
request on the specified port.
checkPackageAccess
public void checkPackageAccess(String
pkg)
This method checks to see if the calling thread is
allowed access to the package with the specified name.
Parameters: pkg-the
name of the package to be checked.
Throws: SecurityException
if the calling thread doesn't have permission to access the package.
checkPackageDefinition
public void checkPackageDefinition(String
pkg)
This method checks to see if the calling thread is
allowed to define classes in the package with the specified name.
Parameters: pkg-the
name of the package to be checked.
Throws: SecurityException
if the calling thread doesn't have permission to define classes
in the package.
checkPropertiesAccess
public void checkPropertiesAccess()
This method checks to see if the calling thread is
allowed access to the system properties.
Throws: SecurityException
if the calling thread doesn't have permission to access the system
properties.
checkPropertyAccess
public void checkPropertyAccess(String
key)
This method checks to see if the calling thread is
allowed access to the system property with the specified key name.
Parameters: key-the
key name for the system property to check.
Throws: SecurityException
if the calling thread doesn't have permission to access the system
property with the specified key name.
checkRead
public void checkRead(FileDescriptor
fd)
This method checks to see if the calling thread is
allowed access to read from the file with the specified file descriptor.
Parameters: fd-the
file descriptor for the file to be checked.
Throws: SecurityException
if the calling thread doesn't have permission to read from the
file.
checkRead
public void checkRead(String filename)
This method checks to see if the calling thread is
allowed access to read from the file with the specified platform-specific
filename.
Parameters: file-the
platform-specific filename for the file to be checked.
Throws: SecurityException
if the calling thread doesn't have permission to read from the
file.
checkRead
public void checkRead(String file, Object
context)
This method checks to see if the specified security
context is allowed access to read from the file with the specified
platform-specific filename.
Parameters:
file-the platform-specific
filename for the file to be checked.
context-the security context
for the check.
Throws: SecurityException
if the specified security context doesn't have permission to read
from the file.
checkSetFactory
public void checkSetFactory()
This method checks to see if the calling thread is
allowed access to set the socket or stream handler factory used
by the URL class.
Throws: SecurityException
if the calling thread doesn't have permission to set the socket
or stream handler factory.
checkTopLevelWindow
public boolean checkTopLevelWindow(Object
window)
This method checks to see if the calling thread is
trusted to show the specified top-level window.
Parameters: window-the
top-level window to be checked.
Returns: true
if the calling thread is trusted to show the top-level window;
false otherwise.
checkWrite
public void checkWrite(FileDescriptor
fd)
This method checks to see if the calling thread is
allowed access to write to the file with the specified file descriptor.
Parameters: fd-the
file descriptor for the file to be checked.
Throws: SecurityException
if the calling thread doesn't have permission to write to the
file.
checkWrite
public void checkWrite(String file)
This method checks to see if the calling thread is
allowed access to write to the file with the specified platform-specific
filename.
Parameters: file-the
platform-specific filename for the file to be checked.
Throws: SecurityException
if the calling thread doesn't have permission to write to the
file.
classDepth
protected int classDepth(String name)
This method determines the stack depth of the class
with the specified name.
Parameters: name-the
fully qualified name of the class to determine the stack depth
of.
Returns: The stack depth of the class, or -1
if the class can't be found in any stack frame.
classLoaderDepth
protected int classLoaderDepth()
This method determines the stack depth of the most
recently executing method of a class defined using a class loader.
Returns: The stack depth of the most recently executing
method of a class defined using a class loader, or -1
if no method is executing within a class defined by a class loader.
currentClassLoader
protected ClassLoader currentClassLoader()
This method determines the current class loader on
the stack.
Returns: The current class loader on the stack,
or null if no class loader exists on the stack.
getClassContext
protected Class[] getClassContext()
This method determines the current execution stack,
which is an array of classes corresponding to each method call
on the stack.
Returns: An array of classes corresponding to each
method call on the stack.
getInCheck
public boolean getInCheck()
This method determines whether there is a security
check in progress.
Returns: true
if a security check is in progress; false
otherwise.
getSecurityContext
public Object getSecurityContext()
This method creates a platform-specific security context
based on the current runtime environment.
Returns: A platform-specific security context based
on the current runtime environment.
inClass
protected boolean inClass(String name)
This method determines if a method in the class with
the specified name is on the execution stack.
Parameters: name-the
name of the class to check.
Returns: true
if a method in the class is on the execution stack; false
otherwise.
inClassLoader
protected boolean inClassLoader()
This method determines if a method in a class defined
using a class loader is on the execution stack.
Returns: true
if a method in a class defined using a class loader is on the
execution stack; false otherwise.
Extends: Object
This class implements a constant string of characters.
The String class provides
a wide range of support for working with strings of characters.
Note that literal string constants are automatically converted
to String objects by the
Java compiler.
String Constructor
public String()
This constructor creates a default string containing
no characters.
String Constructor
public String(byte ascii[], int hibyte)
This constructor creates a string from the specified
array of bytes, with the top 8 bits of each string character set
to hibyte.
Parameters:
ascii-the byte array
that is to be converted to string characters.
hibyte-the high byte value
for each character.
String Constructor
public String(byte ascii[], int hibyte,
int off, int count)
This constructor creates a string of length count
from the specified array of bytes beginning off
bytes into the array, with the top 8 bits of each string character
set to hibyte.
Parameters:
ascii-the byte array
that is to be converted to string characters.
hibyte-the high byte value
for each character.
off-the starting offset into
the array of bytes.
count-the number of bytes
from the array to convert.
Throws: StringIndexOutOfBoundsException
if the offset or count for the byte array is invalid.
String Constructor
public String(char value[])
This constructor creates a string from the specified
array of characters.
Parameters: value-the
character array to initialize the string with.
String Constructor
public String(char value[], int off,
int count)
This constructor creates a string of length count
from the specified array of characters beginning off
bytes into the array.
Parameters:
value-the character
array to initialize the string with.
off-the starting offset into
the array of characters.
count-the number of characters
from the array to use in initializing the string.
Throws: StringIndexOutOfBoundsException
if the offset or count for the character array is invalid.
String Constructor
public String(String value)
This method creates a new string that is a copy of
the specified string.
Parameters: value-the
string to initialize this string with.
String Constructor
public String(StringBuffer buffer)
This method creates a new string that is a copy of
the contents of the specified string buffer.
Parameters: buffer-the
string buffer to initialize this string with.
charAt
public char charAt(int index)
This method determines the character at the specified
index. Note that string indexes are zero based, meaning that the
first character is located at index 0.
Parameters: index-the
index of the desired character.
Returns: The character at the specified index.
Throws: StringIndexOutOfBoundsException
if the index is out of range.
compareTo
public int compareTo(String anotherString)
This method compares this string with the specified
string lexicographically.
Parameters: anotherString-the
string to be compared with.
Returns: If this string is equal to the specified
string, a value less than 0 if this string is lexicographically
less than the specified string, or a value greater than 0 if this
string is lexicographically greater than the specified string.
concat
public String concat(String str)
This method concatenates the specified string onto
the end of this string.
Parameters: str-the
string to concatenate.
Returns: This string, with the specified string
concatenated onto the end.
copyValueOf
public static String copyValueOf(char
data[])
This method converts a character array to an equivalent
string by creating a new string and copying the characters into
it.
Parameters: data-the
character array to convert to a string.
Returns: A string representation of the specified
character array.
copyValueOf
public static String copyValueOf(char
data[], int off, int count)
This method converts a character array to an equivalent
string by creating a new string and copying count
characters into it beginning at off.
Parameters:
data-the character
array to convert to a string.
off-the starting offset into
the character array.
count-the number of characters
from the array to use in initializing the string.
Returns: A string representation of the specified
character array beginning at off
and of length count.
endsWith
public boolean endsWith(String suffix)
This method determines whether this string ends with
the specified suffix.
Parameters: suffix-the
suffix to check.
Returns: true
if this string ends with the specified suffix; false
otherwise.
equals
public boolean equals(Object obj)
This method compares the specified object to this
string. The equals method
returns true only if the
specified object is a String
object of the same length and contains the same characters as
this string.
Parameters: obj-the
object to compare.
Returns: true
if the specified object is a String
object of the same length and contains the same characters as
this string; false otherwise.
equalsIgnoreCase
public boolean equalsIgnoreCase(String
anotherString)
This method compares the specified string to this
string, ignoring case.
Parameters: anotherString-the
string to compare.
Returns: true
if the specified string is of the same length and contains the
same characters as this string, ignoring case; false
otherwise.
getBytes
public void getBytes(int srcBegin, int
srcEnd, byte dst[], int dstBegin)
This method copies the lower 8 bits of each character
in this string beginning at srcBegin
and ending at srcEnd into
the byte array dst beginning
at dstBegin.
Parameters:
srcBegin-index of
the first character in the string to copy.
srcEnd-index of the last
character in the string to copy.
dst-the destination byte
array.
dstBegin-the starting offset
into the byte array.
getChars
public void getChars(int srcBegin, int
srcEnd, char
dst[], int dstBegin)
This method copies each character in this string beginning
at srcBegin and ending at
srcEnd into the character
array dst beginning at dstBegin.
Parameters:
srcBegin-index of
the first character in the string to copy.
srcEnd-index of the last
character in the string to copy.
dst-the destination character
array.
dstBegin-the starting offset
into the character array.
Throws: StringIndexOutOfBoundsException
if there is an invalid index into the buffer.
hashCode
public int hashCode()
This method calculates a hash code for this object.
Returns: A hash code for this object.
indexOf
public int indexOf(int ch)
This method determines the index of the first occurrence
of the specified character in this string.
Parameters: ch-the
character to search for.
Returns: The index of the first occurrence of the
specified character, or -1
if the character doesn't occur.
indexOf
public int indexOf(int ch, int fromIndex)
This method determines the index of the first occurrence
of the specified character in this string beginning at fromIndex.
Parameters:
ch-the character
to search for.
fromIndex-the index to start
the search from.
Returns: The index of the first occurrence of the
specified character beginning at fromIndex,
or -1 if the character doesn't
occur.
indexOf
public int indexOf(String str)
This method determines the index of the first occurrence
of the specified substring in this string.
Parameters: str-the
substring to search for.
Returns: The index of the first occurrence of the
specified substring, or -1
if the substring doesn't occur.
indexOf
public int indexOf(String str, int fromIndex)
This method determines the index of the first occurrence
of the specified substring in this string, beginning at fromIndex.
Parameters:
str-the substring
to search for.
fromIndex-the index to start
the search from.
Returns: The index of the first occurrence of the
specified substring beginning at fromIndex,
or -1 if the substring doesn't
occur.
intern
public String intern()
This method determines a string that is equal to this
string, but is guaranteed to be from a pool of unique strings.
Returns: A string that is equal to this string,
but is guaranteed to be from a pool of unique strings.
lastIndexOf
public int lastIndexOf(int ch)
This method determines the index of the last occurrence
of the specified character in this string.
Parameters: ch-the
character to search for.
Returns: The index of the last occurrence of the
specified character, or -1
if the character doesn't occur.
lastIndexOf
public int lastIndexOf(int ch, int fromIndex)
This method determines the index of the last occurrence
of the specified character in this string, beginning at fromIndex.
Parameters:
ch-the character
to search for.
fromIndex-the index to start
the search from.
Returns: The index of the last occurrence of the
specified character beginning at fromIndex,
or -1 if the character doesn't
occur.
lastIndexOf
public int lastIndexOf(String str)
This method determines the index of the last occurrence
of the specified substring in this string.
Parameters: str-the
substring to search for.
Returns: The index of the last occurrence of the
specified substring, or -1
if the substring doesn't occur.
lastIndexOf
public int lastIndexOf(String str, int
fromIndex)
This method determines the index of the last occurrence
of the specified substring in this string beginning at fromIndex.
Parameters:
str-the substring
to search for.
fromIndex-the index to start
the search from.
Returns: The index of the last occurrence of the
specified substring beginning at fromIndex,
or -1 if the substring doesn't
occur.
length
public int length()
This method determines the length of this string,
which is the number of Unicode characters in the string.
Returns: The length of this string.
regionMatches
public boolean regionMatches(boolean
ignoreCase, int toffset,
String other,int ooffset, int len)
This method determines whether a substring of this
string matches a substring of the specified string, with an option
for ignoring case.
Parameters:
ignoreCase-a boolean
value specifying whether case is ignored; a value of true
means case is ignored, where a value of false
means case isn't ignored.
toffset-the index to start
the substring for this string.
other-the other string to
compare.
ooffset-the index to start
the substring for the string to compare.
len-the number of characters
to compare.
Returns: true
if the substring of this string matches the substring of the specified
string; false otherwise.
regionMatches
public boolean regionMatches(int toffset,
String other, int ooffset, int len)
This method determines whether a substring of this
string matches a substring of the specified string.
Parameters:
toffset-the index
to start the substring for this string.
other-the other string to
compare.
ooffset-the index to start
the substring for the string to compare.
len-the number of characters
to compare.
Returns: true
if the substring of this string matches the substring of the specified
string; false otherwise.
replace
public String replace(char oldChar, char
newChar)
This method replaces all occurrences of oldChar
in this string with newChar.
Parameters:
oldChar-the old character
to replace.
newChar-the new character
to take its place.
Returns: This string, with all occurrences of oldChar
replaced with newChar.
startsWith
public boolean startsWith(String prefix)
This method determines whether this string starts
with the specified prefix.
Parameters: prefix-the
prefix to check.
Returns: true
if this string starts with the specified prefix; false
otherwise.
startsWith
public boolean startsWith(String prefix,
int fromIndex)
This method determines whether this string starts
with the specified prefix beginning at fromIndex.
Parameters:
prefix-the prefix
to check.
fromIndex-the index to start
the search from.
Returns: true
if this string starts with the specified prefix beginning at fromIndex;
false otherwise.
substring
public String substring(int beginIndex)
This method determines the substring of this string
beginning at beginIndex.
Parameters: beginIndex-the
beginning index of the substring, inclusive.
Returns: The substring of this string beginning
at beginIndex.
Throws: StringIndexOutOfBoundsException
if beginIndex is out of range.
substring
public String substring(int beginIndex,
int endIndex)
This method determines the substring of this string
beginning at beginIndex and
ending at endIndex.
Parameters:
beginIndex-the beginning
index of the substring, inclusive.
endIndex-the end index of
the substring, exclusive.
Returns: The substring of this string beginning
at beginIndex and ending
at endIndex.
Throws: StringIndexOutOfBoundsException
if beginIndex or endIndex
is out of range.
toCharArray
public char[] toCharArray()
This method converts this string to a character array
by creating a new array and copying each character of the string
to it.
Returns: A character array representing this string.
toLowerCase
public String toLowerCase()
This method converts all the characters in this string
to lowercase.
Returns: This string, with all the characters converted
to lowercase.
toString
public String toString()
This method returns this string.
Returns: This string itself.
toUpperCase
public String toUpperCase()
This method converts all the characters in this string
to uppercase.
Returns: This string, with all the characters converted
to uppercase.
trim
public String trim()
This method trims leading and trailing whitespace
from this string.
Returns: This string, with leading and trailing
whitespace removed.
valueOf
public static String valueOf(boolean
b)
This method creates a string representation of the
specified boolean value. If the boolean value is true,
the string "true"
is returned; otherwise, the string "false"
is returned.
Parameters: b-the
boolean value to get the string representation of.
Returns: A string representation of the specified
boolean value.
valueOf
public static String valueOf(char c)
This method creates a string representation of the
specified character value.
Parameters: c-the
character value to get the string representation of.
Returns: A string representation of the specified
character value.
valueOf
public static String valueOf(char data[])
This method creates a string representation of the
specified character array.
Parameters: data-the
character array to get the string representation of.
Returns: A string representation of the specified
character array.
valueOf
public static String valueOf(char data[],
int off, int count)
This constructor creates a string representation of
length count from the specified
array of characters beginning off
bytes into the array.
Parameters:
data-the character
array to get the string representation of.
off-the starting offset into
the array of characters.
count-the number of characters
from the array to use in initializing the string.
Returns: A string representation of the specified
character array.
valueOf
public static String valueOf(double d)
This method creates a string representation of the
specified double value.
Parameters: d-the
double value to get the string representation of.
Returns: A string representation of the specified
double value.
valueOf
public static String valueOf(float f)
This method creates a string representation of the
specified float value.
Parameters: f-the
float value to get the string representation of.
Returns: A string representation of the specified
float value.
valueOf
public static String valueOf(int i)
This method creates a string representation of the
specified integer value.
Parameters: i-the
integer value to get the string representation of.
Returns: A string representation of the specified
integer value.
valueOf
public static String valueOf(long l)
This method creates a string representation of the
specified long value.
Parameters: l-the
long value to get the string representation of.
Returns: A string representation of the specified
long value.
valueOf
public static String valueOf(Object obj)
This method creates a string representation of the
specified object. Note that the string representation is the same
as that returned by the toString
method of the object.
Parameters: obj-the
object to get the string representation of.
Returns: A string representation of the specified
object value, or the string "null"
if the object is null.
Extends: Object
This class implements a variable string of characters.
The StringBuffer class provides
a wide range of append and insert methods, along with some other
support methods for getting information about the string buffer.
StringBuffer Constructor
public StringBuffer()
This constructor creates a default string buffer with
no characters.
StringBuffer Constructor
public StringBuffer(int length)
This constructor creates a string buffer with the
specified length.
Parameters: length-the
initial length of the string buffer.
StringBuffer Constructor
public StringBuffer(String str)
This constructor creates a string buffer with the
specified initial string value.
Parameters: str-the
initial string value of the string buffer.
append
public StringBuffer append(boolean b)
This method appends the string representation of the
specified boolean value to the end of this string buffer.
Parameters: b-the
boolean value to be appended.
Returns: This string buffer, with the boolean appended.
append
public StringBuffer append(char c)
This method appends the string representation of the
specified character value to the end of this string buffer.
Parameters: c-the
character value to be appended.
Returns: This string buffer, with the character
appended.
append
public StringBuffer append(char str[])
This method appends the string representation of the
specified character array to the end of this string buffer.
Parameters: str-the
character array to be appended.
Returns: This string buffer, with the character
array appended.
append
public StringBuffer append(char str[],
int off, int len)
This method appends the string representation of the
specified character subarray to the end of this string buffer.
Parameters:
str-the character
array to be appended.
off-the starting offset into
the character array to append.
len-the number of characters
to append.
Returns: This string buffer, with the character
subarray appended.
append
public StringBuffer append(double d)
This method appends the string representation of the
specified double value to the end of this string buffer.
Parameters: d-the
double value to be appended.
Returns: This string buffer, with the double appended.
append
public StringBuffer append(float f)
This method appends the string representation of the
specified float value to the end of this string buffer.
Parameters: f-the
float value to be appended.
Returns: This string buffer, with the float appended.
append
public StringBuffer append(int i)
This method appends the string representation of the
specified integer value to the end of this string buffer.
Parameters: i-the
integer value to be appended.
Returns: This string buffer, with the integer appended.
append
public StringBuffer append(long l)
This method appends the string representation of the
specified long value to the end of this string buffer.
Parameters: l-the
long value to be appended.
Returns: This string buffer, with the long appended.
append
public StringBuffer append(Object obj)
This method appends the string representation of the
specified object to the end of this string buffer.
Parameters: obj-the
object to be appended.
Returns: This string buffer, with the object appended.
append
public StringBuffer append(String str)
This method appends the specified string to the end
of this string buffer.
Parameters: str-the
string to be appended.
Returns: This string buffer, with the string appended.
capacity
public int capacity()
This method determines the capacity of this string
buffer, which is the amount of character storage currently allocated
in the string buffer.
Returns: The capacity of this string buffer.
charAt
public char charAt(int index)
This method determines the character at the specified
index. Note that string buffer indexes are zero based, meaning
that the first character is located at index 0.
Parameters: index-the
index of the desired character.
Returns: The character at the specified index.
Throws: StringIndexOutOfBoundsException
if the index is out of range.
ensureCapacity
public void ensureCapacity(int minimumCapacity)
This method ensures that the capacity of this string
buffer is at least equal to the specified minimum.
Parameters: minimumCapacity-the
minimum desired capacity.
getChars
public void getChars(int srcBegin, int
srcEnd, char dst[], int dstBegin)
This method copies each character in this string buffer
beginning at srcBegin and
ending at srcEnd into the
character array dst beginning
at dstBegin.
Parameters:
srcBegin-index of
the first character in the string buffer to copy.
srcEnd-index of the last
character in the string buffer to copy.
dst-the destination character
array.
dstBegin-the starting offset
into the character array.
Throws: StringIndexOutOfBoundsException
if there is an invalid index into the buffer.
insert
public StringBuffer insert(int off, boolean
b)
This method inserts the string representation of the
specified boolean value at the specified offset of this string
buffer.
Parameters:
off-the offset at
which to insert the boolean.
b-the boolean value to be
inserted.
Returns: This string buffer, with the boolean inserted.
Throws: StringIndexOutOfBoundsException
if the offset is invalid.
insert
public StringBuffer insert(int off, char
c)
This method inserts the string representation of the
specified character value at the specified offset of this string
buffer.
Parameters:
off-the offset at
which to insert the character.
c-the character value to
be inserted.
Returns: This string buffer, with the character
inserted.
Throws: StringIndexOutOfBoundsException
if the offset is invalid.
insert
public StringBuffer insert(int off, char
str[])
This method inserts the string representation of the
specified character array at the specified offset of this string
buffer.
Parameters:
off-the offset at
which to insert the character array.
str-the character array to
be inserted.
Returns: This string buffer, with the character
array inserted.
Throws: StringIndexOutOfBoundsException
if the offset is invalid.
insert
public StringBuffer insert(int off, double
d)
This method inserts the string representation of the
specified double value at the specified offset of this string
buffer.
Parameters:
off-the offset at
which to insert the double.
d-the double value to be
inserted.
Returns: This string buffer, with the double inserted.
Throws: StringIndexOutOfBoundsException
if the offset is invalid.
insert
public StringBuffer insert(int off, float
f)
This method inserts the string representation of the
specified float value at the specified offset of this string buffer.
Parameters:
off-the offset at
which to insert the float.
f-the float value to be inserted.
Returns: This string buffer, with the float inserted.
Throws: StringIndexOutOfBoundsException
if the offset is invalid.
insert
public StringBuffer insert(int off, int
i)
This method inserts the string representation of the
specified integer value at the specified offset of this string
buffer.
Parameters:
off-the offset at
which to insert the integer.
i-the integer value to be
inserted.
Returns: This string buffer, with the integer inserted.
Throws: StringIndexOutOfBoundsException
if the offset is invalid.
insert
public StringBuffer insert(int off, long
l)
This method inserts the string representation of the
specified long value at the specified offset of this string buffer.
Parameters:
off-the offset at
which to insert the long.
l-the long value to be inserted.
Returns: This string buffer, with the long inserted.
Throws: StringIndexOutOfBoundsException
if the offset is invalid.
insert
public StringBuffer insert(int off, Object
obj)
This method inserts the string representation of the
specified object at the specified offset of this string buffer.
Parameters:
off-the offset at
which to insert the object.
obj-the object to be inserted.
Returns: This string buffer, with the object inserted.
Throws: StringIndexOutOfBoundsException
if the offset is invalid.
insert
public StringBuffer insert(int off, String
str)
This method inserts the specified string at the specified
offset of this string buffer.
Parameters:
off-the offset at
which to insert the string.
str-the string to be inserted.
Returns: This string buffer, with the string inserted.
Throws: StringIndexOutOfBoundsException
if the offset is invalid.
length
public int length()
This method determines the length of this string buffer,
which is the actual number of characters stored in the buffer.
Returns: The length of this string buffer.
reverse
public StringBuffer reverse()
This method reverses the character sequence in this
string buffer.
Returns: This string buffer, with the characters
reversed.
setCharAt
public void setCharAt(int index, char
ch)
This method changes the character at the specified
index in this string to the specified character.
Parameters:
index-the index of
the character to change.
ch-the new character.
Throws: StringIndexOutOfBoundsException
if the index is invalid.
setLength
public void setLength(int newLength)
This method explicitly sets the length of this string
buffer. If the length is reduced, characters are lost; if the
length is increased, new characters are set to 0 (null).
Parameters: newLength-the
new length of the string buffer.
Throws: StringIndexOutOfBoundsException
if the length is invalid.
toString
public String toString()
This method determines a constant string representation
of this string buffer.
Returns: The constant string representation of this
string buffer.
Extends: Object
This class provides a platform-independent means of
interacting with the Java runtime system. The System
class provides support for standard input, standard output, and
standard error streams, along with providing access to system
properties, among other things.
Member Variables
public static PrintStream err
This is the standard error stream, which is used for printing
error information. Typically this stream corresponds to display
output since it is important that the user see the error information.
public static InputStream in
This is the standard input stream, which is used for reading character
data. Typically this stream corresponds to keyboard input or another
input source specified by the host environment or user.
public static PrintStream out
This is the standard output stream, which is used for printing
character data. Typically this stream corresponds to display output
or another output destination specified by the host environment
or user.
arraycopy
public static void arraycopy(Object src,
int src_position, Object dst,
int dst_position, int len)
This method copies len
array elements from the src
array beginning at src_position
to the dst array beginning
at dst_position. Both src
and dst must be array objects.
Note that arraycopy does
not allocate memory for the destination array; the memory must
already be allocated.
Parameters:
src-the source array
to copy data from.
src_position-the start position
in the source array.
dst-the destination array
to copy data to.
dst_position-the start position
in the destination array.
len-the number of array elements
to be copied.
Throws: ArrayIndexOutOfBoundsException
if the copy would cause data to be accessed outside of array bounds.
Throws: ArrayStoreException
if an element in the source array could not be stored in the destination
array due to a type mismatch.
currentTimeMillis
public static long currentTimeMillis()
This method determines the current UTC time relative
to midnight, January 1, 1970 UTC, in milliseconds.
Returns: The current UTC time relative to midnight,
January 1, 1970 UTC, in milliseconds.
exit
public static void exit(int status)
This method exits the Java runtime system (virtual
machine) with the specified integer exit status. Note that since
exit kills the runtime system,
it never returns.
Parameters: status-the
integer exit status; this should be set to nonzero if this is
an abnormal exit.
Throws: SecurityException
if the current thread cannot exit with the specified exit status.
gc
public static void gc()
This method invokes the Java garbage collector to
clean up any objects that are no longer needed, usually resulting
in more free memory.
getProperties
public static Properties getProperties()
This method determines the current system properties.
Following is a list of all the system properties guaranteed to
be supported:
- java.version-the Java
version number.
- java.vendor-the Java
vendor-specific string.
- java.vendor.url-the Java
vendor URL.
- java.home-the Java installation
directory.
- java.class.version-the
Java class format version number.
- java.class.path-the Java
CLASSPATH environment variable.
- os.name-the operating
system name.
- os.arch-the operating
system architecture.
- os.version-the operating
system version.
- file.separator-the file
separator.
- path.separator-the path
separator.
- line.separator-the line
separator.
- user.name-the user's
account name.
- user.home-the user's
home directory.
- user.dir-the user's current
working directory.
Returns: The current system properties.
Throws: SecurityException
if the current thread cannot access the system
properties.
getProperty
public static String getProperty(String
key)
This method determines the system property with the
specified key name.
Parameters: key-the
key name of the system property.
Returns: The system property with the specified
key name.
Throws: SecurityException
if the current thread cannot access the system property.
getProperty
public static String getProperty(String
key, String def)
This method determines the system property with the
specified key name; it returns the specified default property
value if the key isn't found.
Parameters:
key-the key name
of the system property.
def-the default property
value to use if the key isn't found.
Returns: The system property with the specified
key name, or the specified default property value if the key isn't
found.
Throws: SecurityException
if the current thread cannot access the system property.
getSecurityManager
public static SecurityManager getSecurityManager()
This method gets the security manager for the Java
program, or null if none exists.
Returns: The security manager for the Java program,
or null if none exists.
load
public static void load(String pathname)
This method loads the dynamic library with the specified
complete path name. This method simply calls the load
method in the Runtime class.
Parameters: pathname-the
path name of the library to load.
Throws: UnsatisfiedLinkError
if the library doesn't exist.
Throws: SecurityException
if the current thread can't load the library.
loadLibrary
public static void loadLibrary(String
libname)
This method loads the dynamic library with the specified
library name. Note that the mapping from library name to a specific
filename is performed in a platform-specific manner.
Parameters: libname-the
name of the library to load.
Throws: UnsatisfiedLinkError
if the library doesn't exist.
Throws: SecurityException
if the current thread can't load the library.
runFinalization
public static void runFinalization()
This method explicitly causes the finalize
methods of any discarded objects to be called. Typically, the
finalize methods of discarded
objects are automatically called asynchronously when the garbage
collector cleans up the objects. You can use runFinalization
to have the finalize methods
called synchronously.
setProperties
public static void setProperties(Properties
props)
This method sets the system properties to the specified
properties.
Parameters: props-the
new properties to be set.
setSecurityManager
public static void setSecurityManager(SecurityManager
s)
This method sets the security manager to the specified
security manager. Note that the security manager can be set only
once for a Java program.
Parameters: s-the
new security manager to be set.
Throws: SecurityException
if the security manager has already been set.
Extends: Object
Implements: Runnable
This class provides the overhead necessary to manage
a single thread of execution within a process. The Thread
class is the basis for multithreaded programming in Java.
Member Constants
public final static int MAX_PRIORITY
This is a constant representing the maximum priority a thread
can have, which is set to 10.
public final static int MIN_PRIORITY
This is a constant representing the minimum priority a thread
can have, which is set to 1.
public final static int NORM_PRIORITY
This is a constant representing the normal (default) priority
for a thread, which is set to 5.
Thread Constructor
public Thread()
This constructor creates a default thread. Note that
threads created with this constructor must have overridden their
run method to actually do
anything.
Thread Constructor
public Thread(Runnable target)
This constructor creates a thread that uses the run
method of the specified runnable.
Parameters: target-the
object whose run method is
used by the thread.
Thread Constructor
public Thread(ThreadGroup group, Runnable
target)
This constructor creates a thread belonging to the
specified thread group that uses the run
method of the specified runnable.
Parameters:
group-the thread
group the thread is to be a member of.
target-the object whose run
method is used by the thread.
Thread Constructor
public Thread(String name)
This constructor creates a thread with the specified
name.
Parameters: name-the
name of the new thread.
Thread Constructor
public Thread(ThreadGroup group, String
name)
This constructor creates a thread belonging to the
specified thread group with the specified name.
Parameters:
group-the thread
group the thread is to be a member of.
name-the name of the new
thread.
Thread Constructor
public Thread(Runnable target, String
name)
This constructor creates a thread with the specified
name that uses the run method
of the specified runnable.
Parameters:
target-the object
whose run method is used
by the thread.
name-the name of the new
thread.
Thread Constructor
public Thread(ThreadGroup group, Runnable
target, String name)
This constructor creates a thread belonging to the
specified thread group with the specified name that uses the run
method of the specified runnable.
Parameters:
group-the thread
group the thread is to be a member of.
target-the object whose run
method is used by the thread.
name-the name of the new
thread.
activeCount
public static int activeCount()
This method determines the number of active threads
in this thread's thread group.
Returns: The number of active threads in this thread's
thread group.
checkAccess
public void checkAccess()
This method checks to see if the currently running
thread is allowed access to this thread.
Throws: SecurityException
if the calling thread doesn't have access to this thread.
countStackFrames
public int countStackFrames()
This method determines the number of stack frames
in this thread. Note that the thread must be suspended to use
this method.
Returns: The number of stack frames in this thread.
Throws: IllegalThreadStateException
if the thread is not suspended.
currentThread
public static Thread currentThread()
This method determines the currently running thread.
Returns: The currently running thread.
destroy
public void destroy()
This method destroys this thread without performing
any cleanup, meaning that any monitors locked by the thread remain
locked. Note that this method should only be used as a last resort
for destroying a thread.
dumpStack
public static void dumpStack()
This method prints a stack trace for this thread.
Note that this method is useful only for debugging.
enumerate
public static int enumerate(Thread list[])
This method fills the specified array with references
to every active thread in this thread's thread group.
Parameters: list-an
array to hold the enumerated threads.
Returns: The number of threads added to the array.
getName
public final String getName()
This method determines the name of this thread.
Returns: The name of this thread.
getPriority
public final int getPriority()
This method determines the priority of this thread.
Returns: The priority of this thread.
getThreadGroup
public final ThreadGroup getThreadGroup()
This method determines the thread group for this thread.
Returns: The thread group for this thread.
interrupt
public void interrupt()
This method interrupts this thread.
interrupted
public static boolean interrupted()
This method determines if this thread has been interrupted.
Returns: true
if the thread has been interrupted; false
otherwise.
isAlive
public final boolean isAlive()
This method determines if this thread is active. An
active thread is a thread that has been started and has not yet
stopped.
Returns: true
if the thread is active; false
otherwise.
isDaemon
public final boolean isDaemon()
This method determines if this thread is a daemon
thread. A daemon thread is a background thread that is owned by
the runtime system rather than a specific process.
Returns: true
if the thread is a daemon thread; false
otherwise.
isInterrupted
public boolean isInterrupted()
This method determines if this thread has been interrupted.
Returns: true
if the thread has been interrupted; false
otherwise.
join
public final void join() throws InterruptedException
This method causes the current thread to wait indefinitely
until it dies.
Throws: InterruptedException
if another thread has interrupted this thread.
join
public final void join(long timeout)
throws InterruptedException
This method causes the current thread to wait until
it dies, or until the specified timeout period has elapsed.
Parameters: timeout-the
maximum timeout period to wait, in milliseconds.
Throws: InterruptedException
if another thread has interrupted this thread.
join
public final void join(long timeout,
int nanos) throws InterruptedException
This method causes the current thread to wait until
it dies, or until the specified timeout period has elapsed. The
timeout period in this case is the addition of the timeout
and nanos parameters, which
provide finer control over the timeout period.
Parameters:
timeout-the maximum
timeout period to wait, in milliseconds.
nanos-the additional time
for the timeout period, in nanoseconds.
Throws: InterruptedException
if another thread has interrupted this thread.
resume
public final void resume()
This method resumes this thread's execution if it
has been suspended.
Throws: SecurityException
if the current thread doesn't have access to this thread.
run
public void run()
This method is the body of the thread, which performs
the actual work of the thread. The run
method is called when the thread is started. The run
method is either overridden in a derived Thread
class or implemented in a class implementing the Runnable
interface.
setDaemon
public final void setDaemon(boolean daemon)
This method sets this thread as either a daemon thread
or a user thread based on the specified boolean value. Note that
the thread must be inactive to use this method.
Parameters: daemon-a
boolean value that determines whether the thread is a daemon thread.
Throws: IllegalThreadStateException
if the thread is active.
setName
public final void setName(String name)
This method sets the name of this thread.
Parameters: name-the
new name of the thread.
Throws: SecurityException
if the current thread doesn't have access to this thread.
setPriority
public final void setPriority(int newPriority)
This method sets the priority of this thread.
Parameters: newPriority-the
new priority of the thread.
Throws: IllegalArgumentException
if the priority is not within the range MIN_PRIORITY
to MAX_PRIORITY.
Throws: SecurityException
if the current thread doesn't have access to this thread.
sleep
public static void sleep(long millis)
throws InterruptedException
This method causes the current thread to sleep for
the specified length of time, in milliseconds.
Parameters: millis-the
length of time to sleep, in milliseconds.
Throws: InterruptedException
if another thread has interrupted this thread.
sleep
public static void sleep(long millis,
int nanos) throws InterruptedException
This method causes the current thread to sleep for
the specified length of time. The length of time in this case
is the addition of the millis
and nanos parameters, which
provide finer control over the sleep time.
Parameters:
millis-the length
of time to sleep, in milliseconds.
nanos-the additional time
for the sleep time, in nanoseconds.
Throws: InterruptedException
if another thread has interrupted this thread.
start
public void start()
This method starts this thread, causing the run
method to be executed.
Throws: IllegalThreadStateException
if the thread was already running.
stop
public final void stop()
This method abnormally stops this thread, causing
it to throw a ThreadDeath
object. You can catch the ThreadDeath
object to perform cleanup, but there is rarely a need to do so.
Throws: SecurityException
if the current thread doesn't have access to this thread.
stop
public final synchronized void stop(Throwable
o)
This method abnormally stops this thread, causing
it to throw the specified object. Note that this version of stop
should be used only in very rare situations.
Parameters: o-the
object to be thrown.
Throws: SecurityException
if the current thread doesn't have access to this thread.
suspend
public final void suspend()
This method suspends the execution of this thread.
Throws: SecurityException
if the current thread doesn't have access to this thread.
toString
public String toString()
This method determines a string representation of
this thread, which includes the thread's name, priority, and thread
group.
Returns: A string representation of this thread.
yield
public static void yield()
This method causes the currently executing thread
to yield so that other threads can execute.
Extends: Object
This class implements a thread group, which is a set
of threads that can be manipulated as one. Thread groups can also
contain other thread groups, resulting in a thread hierarchy.
ThreadGroup Constructor
public ThreadGroup(String name)
This constructor creates a thread group with the specified
name. The newly created thread group belongs to the thread group
of the current thread.
Parameters: name-the
name of the new thread group.
ThreadGroup Constructor
public ThreadGroup(ThreadGroup parent,
String name)
This constructor creates a thread group with the specified
name and belonging to the specified parent thread group.
Parameters:
parent-the parent
thread group.
name-the name of the new
thread group.
Throws: NullPointerException
if the specified thread group is null.
Throws: SecurityException
if the current thread cannot create a thread in the specified
thread group.
activeCount
public int activeCount()
This method determines the number of active threads
in this thread group or in any other thread group that has this
thread group as an ancestor.
Returns: The number of active threads in this thread
group or in any other thread group that has this thread group
as an ancestor.
activeGroupCount
public int activeGroupCount()
This method determines the number of active thread
groups that have this thread group as an ancestor.
Returns: The number of active thread groups that
have this thread group as an ancestor.
checkAccess
public final void checkAccess()
This method checks to see if the currently running
thread is allowed access to this thread group.
Throws: SecurityException
if the calling thread doesn't have access to this thread group.
destroy
public final void destroy()
This method destroys this thread group and all of
its subgroups.
Throws: IllegalThreadStateException
if the thread group is not empty or if it was already destroyed.
Throws: SecurityException
if the calling thread doesn't have access to this thread group.
enumerate
public int enumerate(Thread list[])
This method fills the specified array with references
to every active thread in this thread group.
Parameters: list-an
array to hold the enumerated threads.
Returns: The number of threads added to the array.
enumerate
public int enumerate(Thread list[], boolean
recurse)
This method fills the specified array with references
to every active thread in this thread group. If the recurse
parameter is set to true,
all the active threads belonging to subgroups of this thread are
also added to the array.
Parameters:
list-an array to
hold the enumerated threads.
recurse-a boolean value specifying
whether to recursively enumerate active threads in subgroups.
Returns: The number of threads added to the array.
enumerate
public int enumerate(ThreadGroup list[])
This method fills the specified array with references
to every active subgroup in this thread group.
Parameters: list-an
array to hold the enumerated thread groups.
Returns: The number of thread groups added to the
array.
enumerate
public int enumerate(ThreadGroup list[],
boolean recurse)
This method fills the specified array with references
to every active subgroup in this thread group. If the recurse
parameter is set to true,
all the active thread groups belonging to subgroups of this thread
are also added to the array.
Parameters:
list-an array to
hold the enumerated thread groups.
recurse-a boolean value specifying
whether to recursively enumerate active thread groups in subgroups.
Returns: The number of thread groups added to the
array.
getMaxPriority
public final int getMaxPriority()
This method determines the maximum priority of this
thread group. Note that threads in this thread group cannot have
a higher priority than the maximum priority.
Returns: The maximum priority of this thread group.
getName
public final String getName()
This method determines the name of this thread group.
Returns: The name of this thread group.
getParent
public final ThreadGroup getParent()
This method determines the parent of this thread group.
Returns: The parent of this thread group.
isDaemon
public final boolean isDaemon()
This method determines if this thread group is a daemon
thread group. A daemon thread group is automatically destroyed
when all its threads finish executing.
Returns: true
if the thread group is a daemon thread group; false
otherwise.
list
public void list()
This method prints information about this thread group
to standard output, including the active threads in the group.
Note that this method is useful only for debugging.
parentOf
public final boolean parentOf(ThreadGroup
g)
This method checks to see if this thread group is
a parent or ancestor of the specified thread group.
Parameters: g-the
thread group to be checked.
Returns: true
if this thread group is the parent or ancestor of the specified
thread group; false otherwise.
resume
public final void resume()
This method resumes execution of all the threads in
this thread group that have been suspended.
Throws: SecurityException
if the current thread doesn't have access to this thread group
or any of its threads.
setDaemon
public final void setDaemon(boolean daemon)
This method sets this thread group as either a daemon
thread group or a user thread group based on the specified boolean
value. A daemon thread group is automatically destroyed when all
its threads finish executing.
Parameters: daemon-a
boolean value that determines whether the thread group is a daemon
thread group.
Throws: SecurityException
if the current thread doesn't have access to this thread group.
setMaxPriority
public final void setMaxPriority(int
pri)
This method sets the maximum priority of this thread
group.
Parameters: pri-the
new maximum priority of the thread group.
Throws: SecurityException
if the current thread doesn't have access to this thread group.
stop
public final synchronized void stop()
This method stops all the threads in this thread group
and in all of its subgroups.
Throws: SecurityException
if the current thread doesn't have access to this thread group,
any of its threads, or threads in subgroups.
suspend
public final synchronized void suspend()
This method suspends all the threads in this thread
group and in all of its subgroups.
Throws: SecurityException
if the current thread doesn't have access to this thread group,
any of its threads, or threads in subgroups.
toString
public String toString()
This method determines a string representation of
this thread group.
Returns: A string representation of this thread
group.
uncaughtException
public void uncaughtException(Thread
t, Throwable e)
This method is called when a thread in this thread
group exits because of an uncaught exception. You can override
this method to provide specific handling of uncaught exceptions.
Parameters:
t-the thread that
is exiting.
e-the uncaught exception.
Extends: Object
This class provides the core functionality for signaling
when exceptional conditions occur. All errors and exceptions in
the Java system are derived from Throwable.
The Throwable class contains
a snapshot of the execution stack for helping to track down why
exceptional conditions occur.
Throwable Constructor
public Throwable()
This constructor creates a default throwable with
no detail message; the stack trace is automatically filled in.
Throwable Constructor
public constructorhrowable constructor
( constructortring constructormessage)
This constructor creates a throwable with the specified
detail message; the stack trace is automatically filled in.
Parameters: message-the
detail message.
fillInStackTrace
public Throwable fillInStackTrace()
This method fills in the execution stack trace. Note
that this method is only useful when rethrowing this throwable.
Returns: This throwable.
getMessage
public String getMessage()
This method determines the detail message of this
throwable.
Returns: The detail message of this throwable.
printStackTrace
public void printStackTrace()
This method prints this throwable and its stack trace
to the standard error stream.
printStackTrace
public void printStackTrace(PrintStream
s)
This method prints this throwable and its stack trace
to the specified print stream.
Parameters: s-the
print stream to print the stack to.
toString
public String toString()
This method determines a string representation of
this throwable.
Returns: A string representation of this throwable.
This exception class signals that an invalid cast has occurred.
Extends: Exception
This exception class signals that a class could not
be found.
Extends: Exception
This exception class signals that an attempt has been
made to clone an object that doesn't support the Cloneable
interface.
Extends: Throwable
This throwable class indicates exceptional conditions
that a Java program might want to know about.
Extends: Exception
This exception class signals that the current thread
doesn't have access to a class.
Extends: RuntimeException
This exception class signals that a method has been
passed an illegal argument.
Extends: RuntimeException
This exception class signals that a thread has attempted
to access an object's monitor without owning the monitor.
Extends: IllegalArgumentException
This exception class signals that a thread is not
in the proper state for the requested operation.
Extends: RuntimeException
This exception class signals that an index of some
sort is out of bounds.
Extends: Exception
This exception class signals that an attempt has been
made to instantiate an abstract class or an interface.
Extends: Exception
This exception class signals that a thread has been
interrupted that is already waiting or sleeping.
Extends: RuntimeException
This exception class signals that an attempt has been
made to create an array with a negative size.
Extends: RuntimeException
This exception class signals an attempt to access
a null pointer as an object.
Extends: IllegalArgumentException
This exception class signals an attempt to convert
a string to an invalid number format.
Extends: Exception
This exception class signals an exceptional condition
that can reasonably occur in the Java runtime system.
Extends: RuntimeException
This exception class signals that a security violation
has occurred.
Extends: IndexOutOfBoundsException
This exception class signals that an invalid string
index has been used.
Extends: IncompatibleClassChangeError
This error class signals an attempt to call an abstract
method.
Extends: LinkageError
This error class signals an attempt to read a file
in an invalid format.
Extends: Throwable
This throwable class indicates a serious problem beyond
the scope of what a Java program can fix.
Extends: IncompatibleClassChangeError
This error class signals an attempt to access a member
variable or call a method without proper access.
Extends: LinkageError
This error class signals that an incompatible change
has been made to some class definition.
Extends: IncompatibleClassChangeError
This error class signals an attempt to instantiate
an abstract class or an interface.
Extends: VirtualMachineError
This error class signals that some unexpected internal
error has occurred.
Extends: Error
This error class signals that a class has some dependency
on another class, but that the latter class has incompatibly changed
after the compilation of the former class.
Extends: LinkageError
This error class signals that a class definition could
not be found.
Extends: IncompatibleClassChangeError
This error class signals an attempt to access a member
variable that doesn't exist.
Extends: IncompatibleClassChangeError
This error class signals an attempt to call a method
that doesn't exist.
Extends: VirtualMachineError
This error class signals that the Java runtime system
is out of memory.
Extends: VirtualMachineError
This error class signals that a stack overflow has
occurred.
Extends: Error
This error class signals that a thread is being abnormally
stopped via the stop method.
Extends: VirtualMachineError
This error class signals that an unknown but serious
error has occurred.
Extends: LinkageError
This error class signals that a native implementation
of a method declared as native cannot be found.
Extends: LinkageError
This error class signals that a class has failed the
runtime verification test.
Extends: Error
This error class signals that the Java virtual machine
is broken or has run out of resources necessary for it to continue
operating.
|