Generated by
JDiff

java.lang Documentation Differences

This file contains all the changes in documentation in the package java.lang as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class AbstractMethodError

Thrown when an application tries to call an abstract method. Normally this error is caught by the compiler; this error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled. @author unascribed @version 1.15 0216 12/0203/0001 @since JDK1.0

Class ArithmeticException

Thrown when an exceptional arithmetic condition has occurred. For example an integer "divide by zero" throws an instance of this class. @author unascribed @version 1.19 0220 12/0203/0001 @since JDK1.0

Class ArrayIndexOutOfBoundsException

Thrown to indicate that an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array. @author unascribed @version 1.18 0219 12/0203/0001 @since JDK1.0

Class ArrayStoreException

Thrown to indicate that an attempt has been made to store the wrong type of object into an array of objects. For example the following code generates an ArrayStoreException:

 Object x[] = new String[3]; x[0] = new Integer(0); 
@author unascribed @version 1.8 029 12/0203/0001 @since JDK1.0

Class Boolean

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

In addition this class provides many methods for converting a boolean to a String and a String to a boolean as well as other constants and methods useful when dealing with a boolean. @author Arthur van Hoff @version 1.38 0242 12/0203/0001 @since JDK1.0

Class Boolean, constructor Boolean(boolean)

Allocates a Boolean object representing the value argument.

Note: It is rarely appropriate to use this constructor. Unless a new instance is required the static factory #valueOf(boolean) is generally a better choice. It is likely to yield significantly better space and time performance. @param value the value of the Boolean.


Class Byte

The Byte class wraps a value of primitive type byte in an object. An object of type Byte contains a single field whose type is thebyte.

In addition standardthis wrapperclass provides several methods for converting a byte to a String and a String to a byte as well as other constants and valuesmethods useful when dealing with a byte. @author Nakul Saraiya @version 1.20 0228 12/0203/0001 @see java.lang.Number @since JDK1.1

Class Byte, constructor Byte(String)

Constructs a newly allocated Byte object initialized tothat represents the byte value specifiedindicated by the String parameter. The radixstring is assumedconverted to bea byte value in exactly the manner used by the parseByte method for radix 10. @param s the String to be converted to a Byte @exception NumberFormatException If the String does not contain a parsable byte. @see java.lang.Byte#parseByte(java.lang.String int)
Class Byte, constructor Byte(byte)

Constructs a newly allocated Byte object initialized tothat represents the specified byte value. @param value the initial value ofto be represented by the Byte.
Class Byte, byte byteValue()

Returns the value of this Byte as a byte.
Class Byte, int compareTo(Byte)

Compares two BytesByte objects numerically. @param anotherByte the Byte to be compared. @return the value 0 if the argumentthis Byte is equal to thisthe argument Byte; a value less than 0 if this Byte is numerically less than the Byte argument Byte; and a value greater than 0 if this Byte is numerically greater than the Byte argument Byte (signed comparison). @since 1.2
Class Byte, int compareTo(Object)

Compares this Byte object to another Objectobject. If the Objectobject is a Byte this function behaves like compareTo(Byte). Otherwise it throws a ClassCastException (as BytesByte objects are comparable only comparable to other BytesByte objects). @param o the Object to be compared. @return the value 0 if the argument is a Byte numerically equal to this Byte; a value less than 0 if the argument is a Byte numerically greater than this Byte; and a value greater than 0 if the argument is a Byte numerically less than this Byte. @exception ClassCastException if the argument is not a Byte. @see java.lang.Comparable @since 1.2
Class Byte, Byte decode(String)

Decodes a String into a Byte. Accepts decimal hexadecimal and octal numbers ingiven by the following formatsgrammar: [-]
decimal
constant
DecodableString: [-]
Signopt DecimalNumeral
Signopt 0x hexHexDigits
Signopt constant0X [-]HexDigits
Signopt # HexDigits
Signopt hex0 constantOctalDigits

Sign: [
-] 0
octal
DecimalNumeral HexDigits and OctalDigits are defined in §3.10.1 of constantthe Java Language Specification.

The constantsequence of characters following an (optional) negative sign and/or "radix specifier" ("0x" "0X" "#" or leading zero) is parsed as by the Byte.parseByte method with the specifiedindicated radix (10 816 or 168). This constantsequence of characters must berepresent a positive value or a NumberFormatException will resultbe thrown. The result is madenegated negative if first character of the specified String is the negativeminus sign. No whitespace characters are permitted in the String. @param nm the String to decode. @return thea Byte represented byobject holding the specifiedbyte string.value represented by nm @exception NumberFormatException if the String does not contain a parsable byte. @see java.lang.Byte#parseByte(java.lang.String int)

Class Byte, double doubleValue()

Returns the value of this Byte as a double.
Class Byte, boolean equals(Object)

Compares this object to the specified object. The result is true if and only if the argument is not null and is a Byte object that contains the same byte value as this object. @param obj the object to compare with @return true if the objects are the same; false otherwise.
Class Byte, float floatValue()

Returns the value of this Byte as a float.
Class Byte, int hashCode()

Returns a hashcodehash code for this Byte.
Class Byte, int intValue()

Returns the value of this Byte as an int.
Class Byte, long longValue()

Returns the value of this Byte as a long.
Class Byte, byte parseByte(String)

AssumingParses the specifiedstring String representsargument as a signed decimal byte. returns thatThe characters byte'sin value.the Throws an exceptionstring must all ifbe decimal digits except that the Stringfirst character cannotmay be parsedan asASCII minus sign '-' ('\u002D') to indicate a bytenegative value. The radixresulting byte value is assumed toreturned exactly beas if the argument and the radix 10 were given as arguments to the int) method. @param s thea String containing the byte representation to be parsed @return the parsedbyte value ofrepresented by the byteargument in decimal @exception NumberFormatException Ifif the the string does not contain a parsable byte.
Class Byte, byte parseByte(String, int)

AssumingParses the specifiedstring String representsargument as a signed byte in the radix specified by the second argument. The characters in the string must all be digits of the specified radix (as determined by whether int) returns a nonnegative value) except that bytethe first character may be an ASCII minus sign 's-' ('\u002D') to indicate a negative value. ThrowsThe anresulting byte value is returned.

An exception of type NumberFormatException is thrown if any of the Stringfollowing situations occurs:

@param s the String containing the byte representation to be parsed @param radix the radix to be used while parsing s @return the parsedbyte
value ofrepresented by the bytestring argument in the specified radix @exception NumberFormatException If the Stringstring does not contain a parsable byte.
Class Byte, short shortValue()

Returns the value of this Byte as a short.
Class Byte, String toString()

Returns a String object representing this Byte's value. The value is converted to signed decimal representation and returned as a string exactly as if the byte value were given as an argument to the java.lang.Byte#toString(byte) method. @return a string representation of the value of this object in base 10.
Class Byte, String toString(byte)

Returns a new String object representing the specified Bytebyte. The radix is assumed to be 10. @param b the byte to be converted @return the string representation of the specified byte @see java.lang.Integer#toString(int)
Class Byte, Byte valueOf(String)

AssumingReturns a Byte object holding the value given by the specified String. represents a byte returnsThe argument is interpreted as representing a new Bytesigned decimal objectbyte initialized to thatexactly as if value.the Throws an exception ifargument were given to the #parseByte(java.lang.String) cannotmethod. be parsed asThe result is a Byte object that represents the byte value specified by the string. The radix

In isother words this method assumedreturns a Byte object equal to bethe value of:

new 10Byte(Byte.parseByte(s))
@param s the String containing the integerstring to be parsed @return thea Byte instance representingobject holding the parsedvalue byterepresented valueby the string argument @exception NumberFormatException If the String does not contain a parsable byte.
Class Byte, Byte valueOf(String, int)

AssumingReturns a Byte object holding the value extracted from the specified String representswhen parsed with the radix given by the second argument. The first argument is interpreted as representing a signed byte returns a new Bytein the radix specified objectby the second argument exactly as if the initializedargument were given to thatthe valueint) method. Throws an exceptionThe result is ifa Byte object that represents the Stringbyte cannot be parsedvalue specified by asthe string.

In other words this method returns a byteByte object equal to the value of:

new Byte(Byte.parseByte(s radix))
@param s the String containing the integerstring to be parsed @param radix the radix to be used in interpreting s @return thea Byte instanceobject representingholding the parsedvalue byterepresented valueby the string argument in the specified radix. @exception NumberFormatException If the String does not contain a parsable byte.
Class Byte, byte MAX_VALUE

TheA constant holding the maximum value a Bytebyte can have 27-1.
Class Byte, byte MIN_VALUE

TheA constant holding the minimum value a Bytebyte can have -27.
Class Byte, Class TYPE

The Class objectinstance representing the primitive type byte.

Class Character

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

In addition this class provides several methods for determining thea typecharacter's ofcategory a(lowercase characterletter digit etc.) and for converting characters from uppercase to lowercase and vice versa.

ManyCharacter ofinformation is based on the Unicode Standard version 3.0.

The methods and data of class Character are defined in terms of aby the information in "Unicodethe attributeUnicodeData table"file that specifies a nameis for every definedpart of the Unicode codeCharacter point.Database The table also includesmaintained by the Unicode otherConsortium. attributes such as a decimal value an uppercase equivalent a lowercase equivalentThis file specifies various properties including name and general category for every and/ordefined a titlecaseUnicode code equivalent.point Theor character attributerange. tables for specific versions of Unicode

The file and its description are available onfrom the World Wide Web in variousUnicode subdirectories ofConsortium at:

Joy and Steele The Java Language Specification. @author Lee Boynton @author Guy Steele @author Akira Tanaka @version 1.61 02/02/00 @since JDK11.0

Class Character.Subset, constructor Character.Subset(String)

Constructs a new Subset instance. @exception NullPointerException if name is null @param name The name of this subset
Class Character.Subset, boolean equals(Object)

Compares two Subset objects for equality. This method returns true if and only if xthis and ythe argument refer to the same object; and because itsince this method is final it guarantees thisthis guarantee holds for all subclasses.
Class Character.Subset, int hashCode()

Returns the standard hash code as defined by the {@link Object#hashCode} method. This method is final in order to ensure that the equals and hashCode methods will be consistent in all subclasses.

Class Character.UnicodeBlock

A family of character subsets representing the character blocks definedin by the Unicode 2.0 specification. AnyCharacter blocks generally define characters givenused for a specific script or purpose. A character is contained by at most one Unicode block. @since 1.2

Class Character, constructor Character(char)

Constructs a newly allocated Character object and initializes it so that it represents the primitivespecified valuechar argumentvalue. @param value the value for theto be newrepresented by the Character object.
Class Character, char charValue()

Returns the value of this Character object. @return the primitive char value represented by this object.
Class Character, int compareTo(Character)

Compares two CharactersCharacter objects numerically. @param anotherCharacter the Character to be compared. @return the value 0 if the argument Character is equal to this Character; a value less than 0 if this Character is numerically less than the Character argument; and a value greater than 0 if this Character is numerically greater than the Character argument (unsigned comparison). Note that this is strictly a numerical comparison; it is not locale-dependent. @since 1.2
Class Character, int compareTo(Object)

Compares this Character object to another Objectobject. If the Objectobject is a Character this function behaves like compareTo(Character). Otherwise it throws a ClassCastException (as CharactersCharacter objects are comparable only to other CharactersCharacter objects). @param o the Object to be compared. @return the value 0 if the argument is a Character numerically equal to this Character; a value less than 0 if the argument is a Character numerically greater than this Character; and a value greater than 0 if the argument is a Character numerically less than this Character. @exception ClassCastException if the argument is not a Character. @see java.lang.Comparable @since 1.2
Class Character, int digit(char, int)

Returns the numeric value of the character ch in the specified radix.

If the radix is not in the range MIN_RADIX <= radix <= MAX_RADIX or if the value of ch is not a valid digit in the specified radix -1 is returned. A character is a valid digit if at least one of the following is true:

@param ch the character to be converted. @param radix the radix. @return the numeric value represented by the character in the specified radix. @see java.lang.Character#forDigit(int int) @see java.lang.Character#isDigit(char)
Class Character, char forDigit(int, int)

Determines the character representation for a specific digit in the specified radix. If the value of radix is not a valid radix or the value of digit is not a valid digit in the specified radix the null character ('\u0000') is returned.

The radix argument is valid if it is greater than or equal to MIN_RADIX and less than or equal to MAX_RADIX. The digit argument is valid if 0 <= digit <= radix.

If the digit is less than 10 then '0' + digit is returned. Otherwise the value 'a' + digit - 10 is returned. @param digit the number to convert to a character. @param radix the radix. @return the char representation of the specified digit in the specified radix. @see java.lang.Character#MIN_RADIX @see java.lang.Character#MAX_RADIX @see java.lang.Character#digit(char int)

Class Character, int getNumericValue(char)

Returns the int value that the specified Unicode numericcharacter valuerepresents. ofFor example the character as'\u216C' (the roman numeral fifty) will return an int with a nonnegativevalue integerof 50.

The letters A-Z in their uppercase ('\u0041' through '\u005A') lowercase ('\u0061' through '\u007A') and full width variant ('\uFF21' through '\uFF3A' and '\uFF41' through '\uFF5A') forms have numeric values from 10 through 35. This is independent of the Unicode specification which does not assign numeric values to these char values.

If the character does not have a numeric value then -1 is returned. If the character has a numeric value that cannot be represented as a nonnegative integer (for example a fractional value) then -2 is returned. @param ch the character to be converted. @return the numeric value of the character as a nonnegative int value; -2 if the character has a numeric value that is not a nonnegative integer; -1 if the character has no numeric value. @see java.lang.Character#forDigit(int int) @see java.lang.Character#isDigit(char) @since JDK11.1

Class Character, int getType(char)

Returns a value indicating a character's general category. @param ch the character to be tested. @return a value of type int representing the character's general category. @see java.lang.Character#COMBINING_SPACING_MARK @see java.lang.Character#CONNECTOR_PUNCTUATION @see java.lang.Character#CONTROL @see java.lang.Character#CURRENCY_SYMBOL @see java.lang.Character#DASH_PUNCTUATION @see java.lang.Character#DECIMAL_DIGIT_NUMBER @see java.lang.Character#ENCLOSING_MARK @see java.lang.Character#END_PUNCTUATION @see java.lang.Character#FINAL_QUOTE_PUNCTUATION @see java.lang.Character#FORMAT @see java.lang.Character#INITIAL_QUOTE_PUNCTUATION @see java.lang.Character#LETTER_NUMBER @see java.lang.Character#LINE_SEPARATOR @see java.lang.Character#LOWERCASE_LETTER @see java.lang.Character#MATH_SYMBOL @see java.lang.Character#MODIFIER_LETTER @see java.lang.Character#MODIFIER_SYMBOL @see java.lang.Character#NON_SPACING_MARK @see java.lang.Character#OTHER_LETTER @see java.lang.Character#OTHER_NUMBER @see java.lang.Character#OTHER_PUNCTUATION @see java.lang.Character#OTHER_SYMBOL @see java.lang.Character#PARAGRAPH_SEPARATOR @see java.lang.Character#PRIVATE_USE @see java.lang.Character#SPACE_SEPARATOR @see java.lang.Character#START_PUNCTUATION @see java.lang.Character#SURROGATE @see java.lang.Character#TITLECASE_LETTER @see java.lang.Character#UNASSIGNED @see java.lang.Character#UPPERCASE_LETTER @since JDK11.1
Class Character, int hashCode()

Returns a hash code for this Character. @return a hash code value for this object.
Class Character, boolean isDefined(char)

Determines if a character has ais defined meaning in Unicode.

A character is defined if at least one of the following is true:

@param ch the character to be tested @return true if the character has a defined meaning in Unicode; false otherwise. @see java.lang.Character#isDigit(char) @see java.lang.Character#isLetter(char) @see java.lang.Character#isLetterOrDigit(char) @see java.lang.Character#isLowerCase(char) @see java.lang.Character#isTitleCase(char) @see java.lang.Character#isUpperCase(char) @since JDK11.0.2
Class Character, boolean isDigit(char)

Determines if the specified character is a digit.

A character is considered to be a digit if it is not in the rangeits general category type provided by '\u2000' <= Character.getType(ch <= '\u2FFF') and its Unicode name contains the wordis "DECIMAL_DIGIT_NUMBER". For a more complete specification that encompasses all Unicode characters that are defined as digits see Gosling Joy and Steele The Java Language Specification.

These are theSome Unicode character ranges of Unicode characters that are consideredcontain digits:

digitsMany 0x0F20other throughcharacter 0x0F29ranges Tibetancontain digits 0xFF10 through 0xFF19 Fullwidth digitsas well. @param ch the character to be tested. @return true if the character is a digit; false otherwise. @see java.lang.Character#digit(char int) @see java.lang.Character#forDigit(int int) @see java.lang.Character#getType(char)
Class Character, boolean isISOControl(char)

Determines if the specified character is an ISO control character. A character is considered to be an ISO control character if its code is in the range '\u0000' through '\u001F' or in the range '\u007F' through '\u009F'. @param ch the character to be tested. @return true if the character is an ISO control character; false otherwise. @see java.lang.Character#isSpaceChar(char) @see java.lang.Character#isWhitespace(char) @since JDK11.1
Class Character, boolean isIdentifierIgnorable(char)

Determines if the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

The following Unicode characters are ignorable in a Java identifier or a Unicode identifier: 0x0000 through 0x0008

@param ch the character to be tested. @return true if the character is an ignorable control character that may be part of a Java or Unicode identifier; false otherwise. @see java.lang.Character#isJavaIdentifierPart(char) @see java.lang.Character#isUnicodeIdentifierPart(char) @since JDK11.1
Class Character, boolean isJavaIdentifierPart(char)

Determines if the specified character may be part of a Java identifier as other than the first character.

A character may be part of a Java identifier if and only if it is oneany of the following are true:

@param ch the character to be tested. @return true if the character may be part of a UnicodeJava identifier; false otherwise. @see java.lang.Character#isIdentifierIgnorable(char) @see java.lang.Character#isJavaIdentifierStart(char) @see java.lang.Character#isLetterOrDigit(char) @see java.lang.Character#isUnicodeIdentifierPart(char) @since JDK11.1
Class Character, boolean isJavaIdentifierStart(char)

Determines if the specified character is permissible as the first character in a Java identifier.

A character may start a Java identifier if and only if it is one of the following conditions is true:

@param ch the character to be tested. @return true if the character may start a Java identifier; false otherwise. @see java.lang.Character#isJavaIdentifierPart(char) @see java.lang.Character#isLetter(char) @see java.lang.Character#isUnicodeIdentifierStart(char) @since JDK11.1
Class Character, boolean isJavaLetter(char)

Determines if the specified character is a "Java" letter that is the character is permissible as the first character in an identifier in thea Java languageidentifier.

A character is considered tomay bestart a Java letteridentifier if and only if itone of the following is atrue: letter

@param ch the character to be tested. @return true if the character ismay start a Java letteridentifier; false otherwise. @see java.lang.Character#isJavaLetterOrDigit(char) @see java.lang.Character#isJavaIdentifierStart(char) @see java.lang.Character#isJavaLetterOrDigitisJavaIdentifierPart(char) @see java.lang.Character#isLetter(char) @see java.lang.Character#isLetterOrDigit(char) @see java.lang.Character#isUnicodeIdentifierStart(char) @since JDK1.01.202 @deprecated Replaced by isJavaIdentifierStart(char).
Class Character, boolean isJavaLetterOrDigit(char)

Determines if the specified character is a "Java" letter or digit that is themay character isbe permissible aspart of a non-initial characterJava in an identifier inidentifier as other than the Javafirst languagecharacter.

A character ismay considered to bebe part of a Java letter or digitidentifier if and only if any of the following are true:

@param ch the character to be tested. @return true if the character is a Java letter ormay be part of a digitJava identifier; false otherwise. @see java.lang.Character#isJavaIdentifierPartisJavaLetter(char) @see java.lang.Character#isJavaLetterisJavaIdentifierStart(char) @see java.lang.Character#isJavaIdentifierPart(char) @see java.lang.Character#isLetter(char) @see java.lang.Character#isLetterOrDigit(char) @see java.lang.Character#isUnicodeIdentifierPart(char) @since JDK1see java.0lang.Character#isIdentifierIgnorable(char) @since 1.202 @deprecated Replaced by isJavaIdentifierPart(char).
Class Character, boolean isLetter(char)

Determines if the specified character is a letter. For a more complete specification that encompasses all Unicode characters see Gosling Joy and Steele The Java Language Specification.

A character is considered to be a letter if and only if it is specifiedits to be a lettergeneral category type provided by the Unicode 2Character.0 standard getType(category "Lu" "Ll" "Lt" "Lm" or "Lo" in the Unicode specification data filech). Note that most ideographic characters areis any of the consideredfollowing: to be

Not all letters have case: many. UnicodeMany characters are letters but are neither uppercase nor lowercase nor titlecase. @param ch the character to be tested. @return true if the character is a letter; false otherwise. @see java.lang.Character#isDigit(char) @see java.lang.Character#isJavaIdentifierStart(char) @see java.lang.Character#isJavaLetter(char) @see java.lang.Character#isJavaLetterOrDigit(char) @see java.lang.Character#isLetterOrDigit(char) @see java.lang.Character#isLowerCase(char) @see java.lang.Character#isTitleCase(char) @see java.lang.Character#isUnicodeIdentifierStart(char) @see java.lang.Character#isUpperCase(char)
Class Character, boolean isLetterOrDigit(char)

Determines if the specified character is a letter or digit. For a more complete specification that encompasses all Unicode characters see Gosling Joy and Steele The Java Language Specification.

A character is considered to be a letter if and only if it is specified to be a letter or a digit by the Unicode 2.0 standard (category "Lu" "Ll" "Lt" "Lm" "Lo" or "Nd" in the Unicode specification data file). In other words isLetterOrDigit is true of a character if and only if either Character.isLetter is true of the(char characterch) or Character.isDigit(char isch) returns true offor the character. @param ch the character to be tested. @return true if the character is a letter or digit; false otherwise. @see java.lang.Character#isDigit(char) @see java.lang.Character#isJavaIdentifierPart(char) @see java.lang.Character#isJavaLetter(char) @see java.lang.Character#isJavaLetterOrDigit(char) @see java.lang.Character#isLetter(char) @see java.lang.Character#isUnicodeIdentifierPart(char) @since JDK11.0.2

Class Character, boolean isLowerCase(char)

Determines if the specified character is a lowercase character.

A character is lowercase if it is notits in the rangegeneral category type '\u2000'provided throughby '\u2FFF'Character.getType(ch) the Unicode attribute table does not specify a mapping to lowercase for the character and at least one of the following is true: The attribute table specifies a mapping to uppercase for the character. The name for the character contains the words "SMALL LOWERCASE_LETTER". The name for the character contains the words "SMALL LIGATURE".

A character is considered to be lowercase if and only if itThe is specified to befollowing are examples of lowercase by the Unicode 2.0 standard (category "Ll" in the Unicode specification data file). Of the ISO-LATIN-1 characters (character codes 0x0000 through 0x00FF) the following are lowercase:

 a b c d e f g h i j k l m n o p q r s t u v w x y z '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6' '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE' '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6' '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF' 

Many other Unicode characters are lowercase too.

@param ch the character to be tested. @return true if the character is lowercase; false otherwise. @see java.lang.Character#isLowerCase(char) @see java.lang.Character#isTitleCase(char) @see java.lang.Character#toLowerCase(char) @see java.lang.Character#getType(char)

Class Character, boolean isSpace(char)

Determines if the specified character is ISO-LATIN-1 white space. This method returns true for the following five characters only:
'\t' '\u0009' HORIZONTAL TABULATION
'\n' '\u000A' NEW LINE
'\f' '\u000C' FORM FEED
'\r' '\u000D' CARRIAGE RETURN
 ' '\u0020' SPACE
@param ch the character to be tested. @return true if the character is ISO-LATIN-1 white space; false otherwise. @see java.lang.Character#isSpaceChar(char) @see java.lang.Character#isWhitespace(char) @deprecated Replaced by isWhitespace(char).
Class Character, boolean isSpaceChar(char)

Determines if the specified character is a Unicode space character. A character is considered to be a space character if and only if it is specified to be a space character by the Unicode 2standard.0 standardThis (categorymethod returns true if the character's "Zs"general "Zlcategory type oris "Zp"any inof the Unicodefollowing: specification data @param ch the character to be tested. @return true if the character is a space character; false otherwise. @see java.lang.Character#isWhitespace(char) @since JDK11.1
Class Character, boolean isTitleCase(char)

Determines if the specified character is a titlecase character.

A character is considered to bea titlecase if and onlycharacter if it isits specified to be titlecasegeneral category type provided by the Unicode 2Character.0 standard getType(category "Lt" in the Unicode specificationch) datais file)TITLECASE_LETTER.

The printed representations of four UnicodeSome characters look like pairs of Latin letters. For example there is an uppercase letter that looks like "LJ" and has a corresponding lowercase letter that looks like "lj". A third form which looks like "Lj" is the appropriate form to use when rendering a word in lowercase with initial capitals as for a book title.

These are some of the Unicode characters for which this method returns true:

Many other Unicode characters are titlecase too.

@param ch the character to be tested. @return true if the character is titlecase; false otherwise. @see java.lang.Character#isLowerCase(char) @see java.lang.Character#isUpperCase(char) @see java.lang.Character#toTitleCase(char) @see java.lang.Character#getType(char) @since JDK11.0.2

Class Character, boolean isUnicodeIdentifierPart(char)

Determines if the specified character may be part of a Unicode identifier as other than the first character.

A character may be part of a Unicode identifier if and only if it is one of the following statements is true:

@param ch the character to be tested. @return true if the character may be part of a Unicode identifier; false otherwise. @see java.lang.Character#isIdentifierIgnorable(char) @see java.lang.Character#isJavaIdentifierPart(char) @see java.lang.Character#isLetterOrDigit(char) @see java.lang.Character#isUnicodeIdentifierStart(char) @since JDK11.1
Class Character, boolean isUnicodeIdentifierStart(char)

Determines if the specified character is permissible as the first character in a Unicode identifier.

A character may start a Unicode identifier if and only if itone of the following conditions is atrue:

@param ch the character to be tested. @return true if the character may start a Unicode identifier; false otherwise. @see java.lang.Character#isJavaIdentifierStart(char) @see java.lang.Character#isLetter(char) @see java.lang.Character#isUnicodeIdentifierPart(char) @since JDK11.1
Class Character, boolean isUpperCase(char)

Determines if the specified character is an uppercase character.

A character is uppercase if it is notits in the rangegeneral category type '\u2000'provided throughby '\u2FFF'Character.getType(ch) the Unicode attribute table does not specify a mapping to uppercase for the character and at least one of the following is true: The attribute table specifies a mapping to lowercase for the character. The name for the character contains the words "CAPITAL UPPERCASE_LETTER". The name for the character contains the words "CAPITAL LIGATURE".

Of the ISO-LATIN-1 characters (character codes 0x0000 through 0x00FF) theThe following are examples of uppercase characters:

 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7' '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF' '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8' '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE' 

Many other Unicode characters are uppercase too.

@param ch the character to be tested. @return true if the character is uppercase; false otherwise. @see java.lang.Character#isLowerCase(char) @see java.lang.Character#isTitleCase(char) @see java.lang.Character#toUpperCase(char) @see java.lang.Character#getType(char) @since 1.0

Class Character, boolean isWhitespace(char)

Determines if the specified character is white space according to Java. A character is considered to be a Java whitespace character if and only if it satisfies one of the following criteria: @param ch the character to be tested. @return true if the character is a Java whitespace character; false otherwise. @see java.lang.Character#isSpaceChar(char) @since JDK11.1
Class Character, char toLowerCase(char)

TheConverts given character is mapped to its lowercase equivalent; if the character has no lowercase equivalent the character itself is returned. A character hasargument ato lowercase equivalent if and only if ausing lowercasecase mapping is specified for the characterinformation infrom the Unicode attributeUnicodeData tablefile.

Note that some Unicode characters in the range '\u2000' to '\u2FFF'Character.isLowerCase(Character.toLowerCase(ch)) have lowercase mappings; this method does map such characters tonot their lowercasealways return equivalentstrue even though the methodfor some ranges of isUpperCasecharacters does not returnparticularly those that trueare for such characterssymbols or ideographs. @param ch the character to be converted. @return the lowercase equivalent of the character if any; otherwise the character itself. @see java.lang.Character#isLowerCase(char) @see java.lang.Character#isUpperCase(char) @see java.lang.Character#toTitleCase(char) @see java.lang.Character#toUpperCase(char)

Class Character, String toString()

Returns a String object representing this character's value. Converts this Character object to a's stringvalue. The result is a string whoseof length is 1. The string'swhose sole component is the primitive char value represented by this Character object. @return a string representation of this object.
Class Character, char toTitleCase(char)

Converts the character argument to titlecase. A character has a titlecase equivalent if andusing case mapping information from the UnicodeData onlyfile. ifIf a titlecasecharacter mapping is specified for the character in the Unicode attributehas no explicit titlecase mapping and is not itself a table.titlecase Note that some Unicode characters in the rangechar according to UnicodeData then the uppercase mapping is '\u2000'returned throughas '\u2FFF'an haveequivalent titlecase mappings; thismapping. method doesIf the mapchar such characters to theirargument is already a titlecase equivalents even though the method isTitleCasechar does notthe returnsame truechar for suchvalue will charactersbe returned.

There are only four Unicode characters that are truly titlecase formsNote that are distinct from uppercase formsCharacter. As a rule if a character has no true titlecase equivalent but does have an uppercase mapping then the Unicode 2isTitleCase(Character.0 attribute table specifies atoTitleCase(ch)) titlecase mapping that isdoes not always return thetrue same as the uppercase mappingfor some ranges of characters. @param ch the character to be converted. @return the titlecase equivalent of the character if any; otherwise the character itself. @see java.lang.Character#isTitleCase(char) @see java.lang.Character#toLowerCase(char) @see java.lang.Character#toUpperCase(char) @since JDK11.0.2

Class Character, char toUpperCase(char)

Converts the character argument to uppercase. A character has an uppercase equivalent if and only if anusing uppercasecase mapping is specified for the characterinformation infrom the Unicode attributeUnicodeData tablefile.

Note that some Unicode characters in the range '\u2000' to '\u2000FFF'Character.isUpperCase(Character.toUpperCase(ch)) have uppercase mappings; this method does map such characters tonot their titlecasealways return equivalentstrue even though the methodfor some ranges of isLowerCasecharacters does not returnparticularly those that trueare for such characterssymbols or ideographs. @param ch the character to be converted. @return the uppercase equivalent of the character if any; otherwise the character itself. @see java.lang.Character#isLowerCase(char) @see java.lang.Character#isUpperCase(char) @see java.lang.Character#toLowerCase(char) @see java.lang.Character#toTitleCase(char)

Class Character, byte COMBINING_SPACING_MARK

PublicGeneral data forcategory enumerated"Mc" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte CONNECTOR_PUNCTUATION

PublicGeneral data forcategory enumerated"Pc" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte CONTROL

PublicGeneral data forcategory enumerated"Cc" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte CURRENCY_SYMBOL

PublicGeneral data forcategory enumerated"Sc" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte DASH_PUNCTUATION

PublicGeneral data forcategory enumerated"Pd" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte DECIMAL_DIGIT_NUMBER

PublicGeneral data forcategory enumerated"Nd" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte ENCLOSING_MARK

PublicGeneral data forcategory enumerated"Me" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte END_PUNCTUATION

PublicGeneral data forcategory enumerated"Pe" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte FORMAT

PublicGeneral data forcategory enumerated"Cf" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte LETTER_NUMBER

PublicGeneral data forcategory enumerated"Nl" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte LINE_SEPARATOR

PublicGeneral data forcategory enumerated"Zl" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte LOWERCASE_LETTER

PublicGeneral data forcategory enumerated"Ll" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte MATH_SYMBOL

PublicGeneral data forcategory enumerated"Sm" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, int MAX_RADIX

The maximum radix available for conversion to and from Stringsstrings. The constant value of this field is the largest value permitted for the radix argument in radix-conversion methods such as the digit method the forDigit method and the toString method of class Integer. @see java.lang.Character#digit(char int) @see java.lang.Character#forDigit(int int) @see java.lang.Integer#toString(int int) @see java.lang.Integer#valueOf(java.lang.String)
Class Character, char MAX_VALUE

The constant value of this field is the largest value of type char '\uFFFF'. @since JDK11.0.2
Class Character, int MIN_RADIX

The minimum radix available for conversion to and from Stringsstrings. The constant value of this field is the smallest value permitted for the radix argument in radix-conversion methods such as the digit method the forDigit method and the toString method of class Integer. @see java.lang.Character#digit(char int) @see java.lang.Character#forDigit(int int) @see java.lang.Integer#toString(int int) @see java.lang.Integer#valueOf(java.lang.String)
Class Character, char MIN_VALUE

The constant value of this field is the smallest value of type char '\u0000'. @since JDK11.0.2
Class Character, byte MODIFIER_LETTER

PublicGeneral data forcategory enumerated"Lm" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte MODIFIER_SYMBOL

PublicGeneral data forcategory enumerated"Sk" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte NON_SPACING_MARK

PublicGeneral data forcategory enumerated"Mn" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte OTHER_LETTER

PublicGeneral data forcategory enumerated"Lo" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte OTHER_NUMBER

PublicGeneral data forcategory enumerated"No" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte OTHER_PUNCTUATION

PublicGeneral data forcategory enumerated"Po" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte OTHER_SYMBOL

PublicGeneral data forcategory enumerated"So" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte PARAGRAPH_SEPARATOR

PublicGeneral data forcategory enumerated"Zp" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte PRIVATE_USE

PublicGeneral data forcategory enumerated"Co" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte SPACE_SEPARATOR

PublicGeneral data forcategory enumerated"Zs" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte START_PUNCTUATION

PublicGeneral data forcategory enumerated"Ps" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte SURROGATE

PublicGeneral data forcategory enumerated"Cs" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte TITLECASE_LETTER

PublicGeneral data forcategory enumerated"Lt" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, Class TYPE

The Class objectinstance representing the primitive type char. @since JDK11.1
Class Character, byte UNASSIGNED

PublicGeneral data forcategory enumerated"Cn" Unicode general category typesin the Unicode specification. @since JDK11.1
Class Character, byte UPPERCASE_LETTER

PublicGeneral data forcategory enumerated"Lu" Unicode general category typesin the Unicode specification. @since JDK11.1

Class Class

Instances of the class Class represent classes and interfaces in a running Java application. Every array also belongs to a class that is reflected as a Class object that is shared by all arrays with the same element type and number of dimensions. The primitive Java types (boolean byte char short int long float and double) and the keyword void are also represented as Class objects.

Class has no public constructor. Instead Class objects are constructed automatically by the Java Virtual Machine as classes are loaded and by calls to the defineClass method in the class loader.

The following example uses a Class object to print the class name of an object:

 void printClassName(Object obj) { System.out.println("The class of " + obj + " is " + obj.getClass().getName()); } 
@author unascribed @version 1.107 02135 05/0225/0001 @see java.lang.ClassLoader#defineClass(byte[] int int) @since JDK1.0
Class Class, Class forName(String, boolean, ClassLoader)

Returns the Class object associated with the class or interface with the given string name using the given class loader. Given the fully qualified name for a class or interface (in the same format returned by getName) this method attempts to locate load and link the class or interface. The specified class loader is used to load the class or interface. If the parameter loader is null the class is loaded through the bootstrap class loader. The class is initialized only if the initialize parameter is true and if it has not been initialized earlier.

If name denotes a primitive type or void an attempt will be made to locate a user-defined class in the unnamed package whose name is name. Therefore this method cannot be used to obtain any of the Class objects representing primitive types or void.

If name denotes an array class the component type of the array class is loaded but not initialized.

For example in an instance method the expression:

 Class.forName("Foo") 
is equivalent to:
 Class.forName("Foo" true this.getClass().getClassLoader()) 
Note that this method throws errors related to loading linking or initializing as specified in Sections 12.2 12.3 and 12.4 of The Java Language Specification. Note that this method does not check whether the requested class is accessible to its caller.

If the loader is null and a security manager is present and the caller's class loader is not null then this method calls the security manager's checkPermission method with a RuntimePermission("getClassLoader") permission to ensure it's ok to access the bootstrap class loader. @param name fully qualified name of the desired class @param initialize whether the class must be initialized @param loader class loader from which the class must be loaded @return class object representing the desired class @exception LinkageError if the linkage fails @exception ExceptionInInitializerError if the initialization provoked by this method fails @exception ClassNotFoundException if the class cannot be located by the specified class loader @see java.lang.Class#forName(String) @see java.lang.ClassLoader @since 1.2

Class Class, Method getDeclaredMethod(String, Class[])

Returns a Method object that reflects the specified declared method of the class or interface represented by this Class object. The name parameter is a String that specifies the simple name of the desired method and the parameterTypes parameter is an array of Class objects that identify the method's formal parameter types in declared order. If more than one method with the same parameter types is declared in a class and one of these methods has a return type that is more specific than any of the others that method is returned; otherwise one of the methods is chosen arbitrarily. If the name is "<init>"or "<clinit>" a NoSuchMethodException is raised.

If there is a security manager this method first calls the security manager's checkMemberAccess method with this and Member.DECLARED as its arguments. If the class is in a package then this method also calls the security manager's checkPackageAccess method with the package name as its argument. Either of these calls could result in a SecurityException. @param name the name of the method @param parameterTypes the parameter array @return the Method object for the method of this class matching the specified name and parameters @exception NoSuchMethodException if a matching method is not found. @exception SecurityException if access to the information is denied. @see java.lang.reflect.Method @see SecurityManager#checkMemberAccess(Class int) @see SecurityManager#checkPackageAccess(String) @since JDK1.1

Class Class, Field[] getFields()

Returns an array containing Field objects reflecting all the accessible public fields of the class or interface represented by this Class object. The elements in the array returned are not sorted and are not in any particular order. This method returns an array of length 0 if the class or interface has no accessible public fields or if it represents an array class a primitive type or void.

Specifically if this Class object represents a class this method returns the public fields of this class and of all its superclasses. If this Class object represents an interface this method returns the fields of this interface and of all its superinterfaces.

If there is a security manager this method first calls the security manager's checkMemberAccess method with this and Member.PUBLIC as its arguments. If the class is in a package then this method also calls the security manager's checkPackageAccess method with the package name as its argument. Either of these calls could result in a SecurityException.

The implicit length field for array classsclass is not reflected by this method. User code should use the methods of class Array to manipulate arrays.

See The Java Language Specification sections 8.2 and 8.3. @return the array of Field objects representing the public fields @exception SecurityException if access to the information is denied. @see java.lang.reflect.Field @see SecurityManager#checkMemberAccess(Class int) @see SecurityManager#checkPackageAccess(String) @since JDK1.1

Class Class, Method getMethod(String, Class[])

Returns a Method object that reflects the specified public member method of the class or interface represented by this Class object. The name parameter is a String specifying the simple name the desired method. The parameterTypes parameter is an array of Class objects that identify the method's formal parameter types in declared order. If parameterTypes is null it is treated as if it were an empty array.

If there is a security manager this method first calls the security manager's checkMemberAccess method with this and Member.PUBLIC as its arguments. If the class is in a package then this method also calls the security manager's checkPackageAccess method with the package name as its argument. Either of these calls could result in a SecurityException.

If the name is "<init>"or "<clinit>" a NoSuchMethodException is raised. Otherwise the method to be reflected is determined by the algorithm that follows. Let C be the class represented by this object:

  1. C is searched for any matching methods. If no matching method is found the algorithm of step 1 is invoked recursively on the superclass of C.
  2. If no method was found in step 1 above the superinterfaces of C are searched for a matching method. If any such method is found it is reflected.
To find a matching method in a class C:  If C declares exactly one public method with the specified name and exactly the same formal parameter types that is the method reflected. If more than one such method is found in C and one of these methods has a return type that is more specific than any of the others that method is reflected; otherwise one of the methods is chosen arbitrarily.

See The Java Language Specification sections 8.2 and 8.4. @param name the name of the method @param parameterTypes the list of parameters @return the Method object that matches the specified name and parameterTypes @exception NoSuchMethodException if a matching method is not found or if then name is "<init>"or "<clinit>". @exception SecurityException if access to the information is denied. @see java.lang.reflect.Method @see SecurityManager#checkMemberAccess(Class int) @see SecurityManager#checkPackageAccess(String) @since JDK1.1

Class Class, Method[] getMethods()

Returns an array containing Method objects reflecting all the public member methods of the class or interface represented by this Class object including those declared by the class or interface and and those inherited from superclasses and superinterfaces. The elements in the array returned are not sorted and are not in any particular order. This method returns an array of length 0 if this Class object represents a class or interface that has no public member methods or if this Class object represents an array class primitive type or void.

If there is a security manager this method first calls the security manager's checkMemberAccess method with this and Member.PUBLIC as its arguments. If the class is in a package then this method also calls the security manager's checkPackageAccess method with the package name as its argument. Either of these calls could result in a SecurityException.

The class initialization method <clinit> is not included in the returned array. If the class declares multiple public member methods with the same parameter types they are all included in the returned array.

See The Java Language Specification sections 8.2 and 8.4. @return the array of Method objects representing the public methods of this class @exception SecurityException if access to the information is denied. @see java.lang.reflect.Method @see SecurityManager#checkMemberAccess(Class int) @see SecurityManager#checkPackageAccess(String) @since JDK1.1

Class Class, int getModifiers()

Returns the Java language modifiers for this class or interface encoded in an integer. The modifiers consist of the Java Virtual Machine's constants for public protected private final static abstract and interface; they should be decoded using the methods of class Modifier.

If the underlying class is an array class then its public private and protected modifiers are the same as those of its component type. If this Class represents a primitive type or void its public modifier is always true and its protected and private modifersmodifiers are always false. If this object represents an array class a primitive type or void then its final modifier is always true and its interface modifermodifier is always false. The values of its other modifiers are not determined by this specification.

The modifier encodings are defined in The Java Virtual Machine Specification table 4.1. @return the int representing the modifiers for this class @see java.lang.reflect.Modifier @since JDK1.1

Class Class, String getName()

Returns the fully-qualified name of the entity (class interface array class primitive type or void) represented by this Class object as a String.

If this Classclass object represents a reference type that is not an array type then the binary name of the class is returned as specified by the Java Language Specification Second Edition. If this class object represents a primitive type or void then the name returned is the name determined by the following table. The encoding of element type names is as follows:

 B byte C char D double F float I int J long Lclassname; class or interface S short Z boolean V void 
If this class object represents a class of arrays then the internal form of the name consists of the name of the element type in Javaas signature formatspecified above preceded by one or more "[" characters representing the depth of array nesting. Thus:
 (new Object[3]).getClass().getName() 
returns "[Ljava.lang.Object;" and:
 (new int[3][4][5][6][7][8][9]).getClass().getName() 
returns "[[[[[[[I". The encoding of element type names is as follows: B byte C char D double F float I int J long Lclassname; class or interface S short Z boolean The class or interface name classname is given in fully qualified form as shown in the example above. @return the fully qualified name of the class or interface represented by this object.
Class Class, ProtectionDomain getProtectionDomain()

Returns the ProtectionDomain of this class. If there is a security manager installed this method first calls the security manager's checkPermission method with a RuntimePermission("getProtectionDomain") permission to ensure it's ok to get the ProtectionDomain. @return the ProtectionDomain of this class @throws SecurityException if a security manager exists and its checkPermission method doesn't allow getinggetting the ProtectionDomain. @see java.security.ProtectionDomain @see SecurityManager#checkPermission @see java.lang.RuntimePermission @since 1.2
Class Class, InputStream getResourceAsStream(String)

Finds a resource with a given name. This method returns null if no resource with this name is found. The rules for searching resources associated with a given class are implemented by the defining class loader of the class.

This method delegates the call to its class loader after making these changes to the resource name: if the resource name starts with "/" it is unchanged; otherwise the package name is prepended to the resource name after converting "." to "/". If this object was loaded by the bootstrap loader the call is delegated to ClassLoader.getSystemResourceAsStream. @param name name of the desired resource @return a java.io.InputStream object. @throws NullPointerException if name is null. @see java.lang.ClassLoader @since JDK1.1

Class Class, Object newInstance()

Creates a new instance of the class represented by this Class object. The class is instantiatiedinstantiated as if by a new expression with an empty argument list. The class is initialized if it has not already been initialized.

If there is a security manager this method first calls the security manager's checkMemberAccess method with this and Member.PUBLIC as its arguments. If the class is in a package then this method also calls the security manager's checkPackageAccess method with the package name as its argument. Either of these calls could result in a SecurityException. @return a newly allocated instance of the class represented by this object. @exception IllegalAccessException if the class or initializerits nullary constructor is not accessible. @exception InstantiationException if this Class represents an abstract class an interface an array class a primitive type or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @exception SecurityException if there is no permission to create a new instance.


Class ClassCastException

Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance. For example the following code generates a ClassCastException:

 Object x = new Integer(0); System.out.println((String)x); 
@author unascribed @version 1.17 0218 12/0203/0001 @since JDK1.0

Class ClassCircularityError

Thrown when a circularity has been detected while initializing a class. @author unascribed @version 1.12 0213 12/0203/0001 @since JDK1.0

Class ClassFormatError

Thrown when the Java Virtual Machine attempts to read a class file and determines that the file is malformed or otherwise cannot be interpreted as a class file. @author unascribed @version 1.17 0218 12/0203/0001 @since JDK1.0

Class ClassLoader

The class ClassLoader is an abstract class. A class loader is an object that is responsible for loading classes. The class ClassLoader is an abstract class. Given the name of a class ita class loader should attempt to locate or generate data that constitutes a definition for the class. A typical strategy is to transform the name into a file name and then read a "class file" of that name from a file system.

Every Class object contains a reference to the ClassLoader that defined it.

Class objects for array classes are not created by class loaders but are created automatically as required by the Java runtime. The class loader for an array class as returned by Class#getClassLoader() is the same as the class loader for its element type; if the element type is a primitive type then the array class has no class loader.

Applications implement subclasses of ClassLoader in order to extend the manner in which the Java virtual machine dynamically loads classes.

Class loaders may typically be used by security managers to indicate security domains.

The ClassLoader class uses a delegation model to search for classes and resources. Each instance of ClassLoader has an associated parent class loader. When called upon to find a class or resource a ClassLoader instance will delegate the search for the class or resource to its parent class loader before attempting to find the class or resource itself. The virtual machine's built-in class loader called the bootstrap class loader does not itself have a parent but may serve as the parent of a ClassLoader instance.

Normally the Java virtual machine loads classes from the local file system in a platform-dependent manner. For example on UNIX systems the virtual machine loads classes from the directory defined by the CLASSPATH environment variable.

However some classes may not originate from a file; they may originate from other sources such as the network or they could be constructed by an application. The method defineClass converts an array of bytes into an instance of class Class. Instances of this newly defined class can be created using the newInstance method in class Class.

The methods and constructors of objects created by a class loader may reference other classes. To determine the class(es) referred to the Java virtual machine calls the loadClass method of the class loader that originally created the class.

For example an application could create a network class loader to download class files from a server. Sample code might look like:

 ClassLoader loader = new NetworkClassLoader(host  port); Object main = loader.loadClass("Main" true).newInstance();  . . . 

The network class loader subclass must define the methods findClass and loadClassData to load a class from the network. Once it has downloaded the bytes that make up the class it should use the method defineClass to create a class instance. A sample implementation is:


 class NetworkClassLoader extends ClassLoader { String host; int port; public Class findClass(String name) { byte[] b = loadClassData(name); return defineClass(name b 0 b.length); } private byte[] loadClassData(String name) { // load the class data from the connection  . . . } } 

@version 1.144 09160 12/1803/01 @see java.lang.Class @see java.lang.Class#newInstance() @see java.lang.ClassLoader#defineClass(byte[] int int) @see java.lang.ClassLoader#loadClass(java.lang.String boolean) @see java.lang.ClassLoader#resolveClass(java.lang.Class) @since JDK1.0
Class ClassLoader, constructor ClassLoader(ClassLoader)

Creates a new class loader using the specified parent class loader for delegation.

If there is a security manager its checkCreateClassLoader method is called. This may result in a security exception. @param parent the parent class loader @throws SecurityException if a security manager exists and its checkCreateClassLoader method doesn't allow creation of a new class loader. @param parent the parent class loader @see java.lang.SecurityException @see java.lang.SecurityManager#checkCreateClassLoader() @since 1.2

Class ClassLoader, Class defineClass(String, byte[], int, int)

Converts an array of bytes into an instance of class Class. Before the Class can be used it must be resolved.

This method assigns a default ProtectionDomain to the newly defined class. The ProtectionDomain contains the set of permissions granted when a call to Policy.getPolicy().getPermissions() is made with a Codesourcecode source of null null. The default domain is created on the first invocation of defineClass and re-used on subsequent calls.

To assign a specific ProtectionDomain to the class use the defineClass method that takes a ProtectionDomain as one of its arguments. @param name the expected name of the class or null if not known using '.' and not '/' as the separator and without a trailing ".class" suffix. @param b the bytes that make up the class data. The bytes in positions off through off+len-1 should have the format of a valid class file as defined by the Java Virtual Machine Specification. @param off the start offset in b of the class data @param len the length of the class data @return the Class object that was created from the specified class data @exception ClassFormatError if the data did not contain a valid class @exception IndexOutOfBoundsException if either off or len is negative or if off+len is greater than b.length. @exception SecurityException if an attempt is made to add this class to a package that contains classes that were signed by a different set of certificates thenthan this class (which is unsigned) or if the class name begins with "java.". @see ClassLoader#loadClass(java.lang.String boolean) @see ClassLoader#resolveClass(java.lang.Class) @see java.security.ProtectionDomain @see java.security.Policy @see java.security.CodeSource @see java.security.SecureClassLoader @since JDK1.1

Class ClassLoader, Class defineClass(String, byte[], int, int, ProtectionDomain)

Converts an array of bytes into an instance of class Class with an optional ProtectionDomain. If the domain is null then a default domain will be assigned to the class as specified in the documentation for byte[ int int)}. Before the class can be used it must be resolved.

The first class defined in a package determines the exact set of certificates that all subsequent classes defined in that package must contain. The set of certificates for a class is obtained from the CodeSource within the ProtectionDomain of the class. Any classes added to that package must contain the same set of certificates or a SecurityException will be thrown. Note that if the name argument is null this check is not performed. You should always pass in the name of the class you are defining as well as the bytes. This ensures that the class you are defining is indeed the class you think it is.

The specified class name cannot begin with "java." since all classes in the java.* packages can only be defined by the bootstrap class loader. @exception ClassFormatError ifIf the dataname didparameter is not containnull a valid classit must be @exceptionequal IndexOutOfBoundsException if eitherto the name offof orthe lenclass is negative or ifspecified by the byte off+lenarray is greater thanb otherwise a b.lengthClassFormatError is raised. @exception SecurityException if an attempt is made to addparam name the expected name of the class or thisnull class to a packageif not known using that'.' contains classesand not that'/' were signed byas the separator and without a differenttrailing set".class" ofsuffix. certificates@param than this class orb the bytes that ifmake up the class namedata. begins withThe bytes "java.".in @parampositions nameoff through off+len-1 should have the nameformat of thea valid class @paramfile bas defined by the classJava bytesVirtual Machine Specification. @param off the start offset in b of the class bytesdata @param len the length of the class bytesdata @param protectionDomain the ProtectionDomain of the class @return the Class object created from the data and optional ProtectionDomain. @exception ClassFormatError if the data did not contain a valid class @exception IndexOutOfBoundsException if either off or len is negative or if off+len is greater than b.length. @exception SecurityException if an attempt is made to add this class to a package that contains classes that were signed by a different set of certificates than this class or if the class name begins with "java.".

Class ClassLoader, Class defineClass(byte[], int, int)

Converts an array of bytes into an instance of class Class. Before the Class can be used it must be resolved. This method is deprecated in favor of the version that takes the class name as its first argument and is more secure. @param b the bytes that make up the class data. The bytes in positions off through off+len-1 should have the format of a valid class file as defined by the Java Virtual Machine Specification. @param off the start offset in b of the class data @param len the length of the class data @return the Class object that was created from the specified class data @exception ClassFormatError if the data did not contain a valid class @exception IndexOutOfBoundsException if either off or len is negative or if off+len is greater than b.length. @see ClassLoader#loadClass(java.lang.String boolean) @see ClassLoader#resolveClass(java.lang.Class) @deprecated Replaced by defineClass(java.lang.String byte[] int int)
Class ClassLoader, ClassLoader getSystemClassLoader()

Returns the system class loader for delegation. This is the default delegation parent for new ClassLoader instances and is typically the class loader used to start the application.

This method is first invoked early in the runtime's startup sequence at which point it creates the system class loader and sets it as the context class loader of the invoking Thread.

The default system class loader is an implementation-dependent instance of this class.

If the system property java.system.class.loader is defined when this method is first invoked then the value of that property is taken to be the name of a class that will be returned as the system class loader. The class is loaded using the default system class loader and must define a public constructor that takes a single parameter of type ClassLoader which is used as the delegation parent. An instance is then created using this constructor with the default system class loader as the parameter. The resulting class loader is defined to be the system class loader.

If a security manager is present and the caller's class loader is not null and the caller's class loader is not the same as or an ancestor of the system class loader then this method calls the security manager's checkPermission method with a RuntimePermission("getClassLoader") permission to ensure it's ok to access the system class loader. If not a SecurityException will be thrown. @return the system ClassLoader for delegation or null if none @throws SecurityException if a security manager exists and its checkPermission method doesn't allow access to the system class loader. @throws IllegalStateException if invoked recursively during the construction of the class loader specified by the java.system.class.loader property. @throws Error if the system property java.system.class.loader is defined but the named class could not be loaded the provider class does not define the required constructor or an exception is thrown by that constructor when it is invoked. The underlying cause of the error can be retrieved via the Throwable#getCause() method. @see SecurityManager#checkPermission @see java.lang.RuntimePermission @sincerevised 1.24


Class ClassNotFoundException

Thrown when an application tries to load in a class through its string name using:

but no definition for the class with the specifedspecified name could be found.

As of release 1.4 this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "optional exception that was raised while loading the class" that may be provided at construction time and accessed via the #getException() method is now known as the cause and may be accessed via the Throwable#getCause() method as well as the aforementioned "legacy method." @author unascribed @version 1.13 0217 12/0203/0001 @see java.lang.Class#forName(java.lang.String) @see java.lang.ClassLoader#findSystemClass(java.lang.String) @see java.lang.ClassLoader#loadClass(java.lang.String boolean) @since JDK1.0

Class ClassNotFoundException, Throwable getException()

Returns the exception that was raised if an error occurred while attempting to load the class. Otherwise returns null.

This method predates the general-purpose exception chaining facility. The Throwable#getCause() method is now the preferred means of obtaining this information. @return the Exception that was raised while loading a class @since 1.2


Class CloneNotSupportedException

Thrown to indicate that the clone method in class Object has been called to clone an object but that the object's class does not implement the Cloneable interface.

Applications that override the clone method can also throw this exception to indicate that an object could not or should not be cloned. @author unascribed @version 1.8 029 12/0203/0001 @see java.lang.Cloneable @see java.lang.Object#clone() @since JDK1.0


Class Cloneable

A class implements the Cloneable interface to indicate to the java.lang.Object#clone() method that it is legal for that method to make a field-for-field copy of instances of that class.

AttemptsInvoking toObject's clone instancesmethod on an instance that dodoes not implement the Cloneable interface resultresults in the exception CloneNotSupportedException being thrown.

TheBy convention classes that implement this interface should override CloneableObject.clone (which is protected) with a public method. See java.lang.Object#clone() for details on overriding this method.

Note that this interface does not contain the clone declaresmethod. Therefore it is not possible to clone an object merely by virtue of the fact that it implements this interface. Even if the clone method is invoked reflectively there is no methodsguarantee that it will succeed. @author unascribed @version 1.10 0213 12/0203/0001 @see java.lang.CloneNotSupportedException @see java.lang.Object#clone() @since JDK1.0


Class Comparable

This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering and the class's compareTo method is referred to as its natural comparison method.

Lists (and arrays) of objects that implement this interface can be sorted automatically by Collections.sort (and Arrays.sort). Objects that implement this interface can be used as keys in a sorted map or elements in a sorted set without the need to specify a comparator.

A class'sThe natural ordering for a class C is said to be consistent with equals if and only if (e1.compareTo((Object)e2) == 0) has the same boolean value as e1.equals((Object)e2) for every e1 and e2 of class C. Note that null is not an instance of any class and e.compareTo(null) should throw a NullPointerException even though e.equals(null) returns false.

It is strongly recommended (though not required) that natural orderings be consistent with equals. This is so because sorted sets (and sorted maps) without explicit comparators behave "strangely" when they are used with elements (or keys) whose natural ordering is inconsistent with equals. In particular such a sorted set (or sorted map) violates the general contract for set (or map) which is defined in terms of the equals operationmethod.

For example if one adds two keys a and b such that ( a.equals((Object)b) && a.compareTo((Object)b) == 0) to a sorted set that does not use an explicit comparator the second add operation returns false (and the size of the sorted set does not increase) because a and b are equivalent from the sorted set's perspective.

Virtually all Java core classes that implement comparable have natural orderings that are consistent with equals. One exception is java.math.BigDecimal whose natural ordering equates BigDecimalsBigDecimal objects with equal values and different precisions (such as 4.0 and 4.00).

For the mathematically inclined the relation that defines the natural ordering on a given class C is:

 {(x y) such that x.compareTo((Object)y) <= 0}. 
The quotient for this total order is:
 {(x y) such that x.compareTo((Object)y) == 0}. 
It follows immediately from the contract for compareTo that the quotient is an equivalence relation on C and that the natural ordering is a total order on C. When we say that a class's natural ordering is consistent with equals we mean that the quotient for the natural ordering is the equivalence relation defined by the class's equals(Object) method:
 {(x y) such that x.equals((Object)y)}. 
@author Josh Bloch @version 1.13 0218 12/0203/0001 @see java.util.Comparator @see java.util.Collections#sort(java.util.List) @see java.util.Arrays#sort(Object[]) @see java.util.SortedSet @see java.util.SortedMap @see java.util.TreeSet @see java.util.TreeMap @since 1.2
Class Comparable, int compareTo(Object)

Compares this object with the specified object for order. Returns a negative integer zero or a positive integer as this object is less than equal to or greater than the specified object.

In the foregoing description the notation sgn(expression) designates the mathematical signum function which is defined to return one of -1 0 or 1 according to whether the value of expression is negative zero or positive. The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.

Finally the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)) for all z.

It is strongly recommended but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals." @param o the Object to be compared. @return a negative integer zero or a positive integer as this object is less than equal to or greater than the specified object. @throws ClassCastException if the specified object's type prevents it from being compared to this Object.


Class Compiler

The Compiler class is provided to support Java-to-native-code compilers and related services. By design the Compiler class does nothing; it serves as a placeholder for a JIT compiler implementation.

When the Java Virtual Machine first starts it determines if the system property java.compiler exists. (System properties are accessible through getProperty and a method defined by the System class.) If so it is assumed to be the name of a library (with a platform-dependent exact location and type); the loadLibrary method in class System is called to load that library. If this loading succeeds the function named java_lang_Compiler_start() in that library is called.

If no compiler is available these methods do nothing. @author Frank Yellin @version 1.15 0217 12/0203/0001 @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String java.lang.String) @see java.lang.System#loadLibrary(java.lang.String) @since JDK1.0

Class Compiler, Object command(Object)

Examines the argument type and its fields and perform some documented operation. No specific operations are required. @param any an argument. @return a compiler-specific value or null if no compiler is available. @exception NullPointerException if any is null.
Class Compiler, boolean compileClass(Class)

Compiles the specified class. @param clazz a class. @return true if the compilation succeeded; false if the compilation failed or no compiler is available. @exception NullPointerException if clazz is null.
Class Compiler, boolean compileClasses(String)

Compiles all classes whose name matches the specified string. @param string the name of the classes to compile. @return true if the compilation succeeded; false if the compilation failed or no compiler is available. @exception NullPointerException if string is null.

Class Double

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

In addition this class provides several methods for converting a double to a String and a String to a double as well as other constants and methods useful when dealing with a double. @author Lee Boynton @author Arthur van Hoff @version 1.63 0279 12/0203/0001 @since JDK1.0

Class Double, constructor Double(String)

Constructs a newly allocated Double object that represents the floating- point value of type double represented by the string. The string is converted to a double value as if by the valueOf method. @param s a string to be converted to a Double. @exception NumberFormatException if the string does not contain a parsable number. @see java.lang.Double#valueOf(java.lang.String)
Class Double, byte byteValue()

Returns the value of this Double as a byte (by casting to a byte). @return the double value represented by this object converted to type byte @since JDK1.1
Class Double, int compareTo(Double)

Compares two DoublesDouble objects numerically. There are two ways in which comparisons performed by this method differ from those performed by the Java language numerical comparison operators (< <= == >= >) when applied to primitive doublesdouble values: This ensures that Double.compareTo(Object) (which inheritsforwards its behavior fromto this method) obeys the general contract for Comparable.compareTo and that the natural order on DoublesDoubles is totalconsistent with equals. @param anotherDouble the Double to be compared. @return the value 0 if anotherDouble is numerically equal to this Double; a value less than 0 if this Double is numerically less than anotherDouble; and a value greater than 0 if this Double is numerically greater than anotherDouble. @since 1.2 @see Comparable#compareTo(Object)
Class Double, int compareTo(Object)

Compares this Double object to another Objectobject. If the Objectobject is a Double this function behaves like compareTo(Double). Otherwise it throws a ClassCastException (as DoublesDouble objects are comparable only to other DoublesDouble objects). @param o the Object to be compared. @return the value 0 if the argument is a Double numerically equal to this Double; a value less than 0 if the argument is a Double numerically greater than this Double; and a value greater than 0 if the argument is a Double numerically less than this Double. @exception ClassCastException if the argument is not a Double. @see java.lang.Comparable @since 1.2
Class Double, long doubleToLongBits(double)

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.

Bit 63 (the bit that is selected by the mask 0x8000000000000000L) represents the sign of the floating-point number. Bits 62-52 (the bits that are selected by the mask 0x7ff0000000000000L) represent the exponent. Bits 51-0 (the bits that are selected by the mask 0x000fffffffffffffL) represent the significand (sometimes called the mantissa) of the floating-point number.

If the argument is positive infinity the result is 0x7ff0000000000000L.

If the argument is negative infinity the result is 0xfff0000000000000L.

If the argument is NaN the result is 0x7ff8000000000000L.

In all cases the result is a long integer that when given to the #longBitsToDouble(long) method will produce a floating-point value equal tothe same as the argument to doubleToLongBits (except all NaN values are collapsed to a single "canonical" NaN value). @param value a double precision floating-point number. @return the bits that represent the floating-point number.

Class Double, long doubleToRawLongBits(double)

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout preserving Not-a-Number (NaN) values.

Bit 63 (the bit that is selected by the mask 0x8000000000000000L) represents the sign of the floating-point number. Bits 62-52 (the bits that are selected by the mask 0x7ff0000000000000L) represent the exponent. Bits 51-0 (the bits that are selected by the mask 0x000fffffffffffffL) represent the significand (sometimes called the mantissa) of the floating-point number.

If the argument is positive infinity the result is 0x7ff0000000000000L.

If the argument is negative infinity the result is 0xfff0000000000000L.

If the argument is NaN the result is the long integer representing the actual NaN value. Unlike the doubleToLongBits method doubleToRawLongBits does not collapse all the bit patterns encoding a NaN valuesto a single "canonical" NaN value.

In all cases the result is a long integer that when given to the #longBitsToDouble(long) method will produce a floating-point value equalthe same toas the argument to doubleToRawLongBits. @param value a double precision floating-point number. @return the bits that represent the floating-point number.

Class Double, double doubleValue()

Returns the double value of this Double object. @return the double value represented by this object.
Class Double, boolean equals(Object)

Compares this object against the specified object. The result is true if and only if the argument is not null and is a Double object that represents a double that has the identical bit pattern to the bitsame pattern ofvalue as the double represented by this object. For this purpose two double values are considered to be the same if and only if the method #doubleToLongBits(double) returns the sameidentical long value when applied to each.

Note that in most cases for two instances of class Double d1 and d2 the value of d1.equals(d2) is true if and only if

 d1.doubleValue() == d2.doubleValue() 

also has the value true. However there are two exceptions:

This definition allows hashtableshash tables to operate properly. @param obj the object to compare with. @return true if the objects are the same; false otherwise. @see java.lang.Double#doubleToLongBits(double)
Class Double, float floatValue()

Returns the float value of this Double object. @return the double value represented by this object is converted to type float and the result of the conversion is returned. @since JDK1.0
Class Double, int hashCode()

Returns a hashcodehash code for this Double object. The result is the exclusive OR of the two halves of the long integer bit representation exactly as produced by the method #doubleToLongBits(double) of the primitive double value represented by this Double object. That is the hashcodehash code is the value of the expression:
 (int)(v^(v>>>32)) 
where v is defined by:
 long v = Double.doubleToLongBits(this.doubleValue()); 
@return a hash code value for this object.
Class Double, int intValue()

Returns the integer value of this Double as an int (by casting to antype int). @return the double value represented by this object is converted to type int and the result of the conversion is returned.
Class Double, boolean isInfinite()

Returns true if this Double value is infinitely large in magnitude false otherwise. @return true if the value represented by this object is positive infinity or negative infinity; false otherwise.
Class Double, boolean isInfinite(double)

Returns true if the specified number is infinitely large in magnitude false otherwise. @param v the value to be tested. @return true if the value of the argument is positive infinity or negative infinity; false otherwise.
Class Double, boolean isNaN()

Returns true if this Double value is the speciala Not-a-Number (NaN) valuefalse otherwise. @return true if the value represented by this object is NaN; false otherwise.
Class Double, boolean isNaN(double)

Returns true if the specified number is the speciala Not-a-Number (NaN) value false otherwise. @param v the value to be tested. @return true if the value of the argument is NaN; false otherwise.
Class Double, double longBitsToDouble(long)

Returns the double-float value corresponding to a given bit representionrepresentation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double precisionformat" bit layout. That floating-point value is returned as the result.

If the argument is 0x7ff0000000000000L the result is positive infinity.

If the argument is 0xfff0000000000000L the result is negative infinity.

If the argument is any value in the range 0x7ff0000000000001L through 0x7fffffffffffffffL or in the range 0xfff0000000000001L through 0xffffffffffffffffL the result is a NaN. AllNo IEEE 754 NaN values offloating-point typeoperation doubleprovided are in effect lumped together by the Java programming language into a single value called NaNby Java can distinguish between two NaN values of the same type with different bit patterns. Distinct values of NaN are only accessibledistinguishable by use of the Double.doubleToRawLongBits method.

In all other cases let s e and m be three values that can be computed from the argument:

 int s = ((bits >> 63) == 0) 1 : -1; int e = (int)((bits >> 52) & 0x7ffL); long m = (e == 0) (bits & 0xfffffffffffffL) << 1 : (bits & 0xfffffffffffffL) | 0x10000000000000L; 
Then the floating-point result equals the value of the mathematical expression s&#183middot;m&#183middot;2e-1075. @param bits any long integer. @return the double floating-point value with the same bit pattern.
Class Double, long longValue()

Returns the long value of this Double as a long (by casting to atype long). @return the double value represented by this object is converted to type long and the result of the conversion is returned.
Class Double, double parseDouble(String)

Returns a new double initialized to the value represented by the specified String as performed by the valueOf method of class Double. @param s the string to be parsed. @return the double value represented by the string argument. @exception NumberFormatException if the string does not contain a parsable double. @see java.lang.Double#valueOf(String) @since 1.2
Class Double, short shortValue()

Returns the value of this Double as a short (by casting to a short). @return the double value represented by this object converted to type short @since JDK1.1
Class Double, String toString()

Returns a Stringstring representation of this Double object. The primitive double value represented by this object is converted to a string exactly as if by the method toString of one argument. @return a String representation of this object. @see java.lang.Double#toString(double)
Class Double, String toString(double)

CreatesReturns a string representation of the double argument. All characters mentioned below are ASCII characters. How many digits must be printed for the fractional part of m or a There must be at least one digit to represent the fractional part and beyond that as many but only as many more digits as are needed to uniquely distinguish the argument value from adjacent values of type double. That is suppose that x is the exact mathematical value represented by the decimal representation produced by this method for a finite nonzero argument d. Then d must be the double value nearest to x; or if two double values are equally close to x then d must be one of them and the least significant bit of the significand of d must be 0.

To create localized string representations of a floating-point value use subclasses of java.text.NumberFormat @param d the double to be converted. @return a string representation of the argument.

Class Double, Double valueOf(String)

Returns a new Double object initialized toholding the double value represented by the specified string. Theargument string s is interpreted as the representation of a floating-point value and a Double object representing that value is created and returned.

If s is null then a NullPointerException is thrown.

Leading and trailing whitespace characters in s are ignored. The rest of s should constitute a FloatValue as described by the lexical rule:

FloatValue:
Signopt NaN
Signopt Infinity
Signopt FloatingPointLiteral
where Sign and FloatingPointLiteral are as defined in #§3.10.2 of the Java Language Specification. If its does not have the form of a FloatValue then a NumberFormatException is thrown. Otherwise its is regarded as representing an exact decimal value in the usual "computerized scientific notation"; this exact decimal value is then conceptually converted to an "infinitely precise" binary value that is then rounded to type double by the usual round-to-nearest rule of IEEE 754 floating-point arithmetic which includes preserving the sign of a zero value. Finally a newDouble object of classrepresenting this Doubledouble value is createdreturned. to represent the

To interpret doublelocalized string representations of a floating-point value use subclasses of java.text.NumberFormat @param s the string to be parsed. @return a newly constructed Double initialized toobject holding the value represented by the stringString argument. @exception NumberFormatException if the string does not contain a parsable number.

Class Double, double MAX_VALUE

TheA constant holding the largest positive finite value of type double. It is equal to the value returned by: Double.longBitsToDouble(0x7fefffffffffffffL) .
Class Double, double MIN_VALUE

TheA constant holding the smallest positive nonzero value of type double. It is equal to the value returned by Double.longBitsToDouble(0x1L).
Class Double, double NEGATIVE_INFINITY

TheA constant holding the negative infinity of type double. It is equal to the value returned by Double.longBitsToDouble(0xfff0000000000000L).
Class Double, double NaN

A constant holding a Not-a-Number (NaN) value of type double. It is equalequivalent to the value returned by Double.longBitsToDouble(0x7ff8000000000000L).
Class Double, double POSITIVE_INFINITY

TheA constant holding the positive infinity of type double. It is equal to the value returned by Double.longBitsToDouble(0x7ff0000000000000L).
Class Double, Class TYPE

The Class objectinstance representing the primitive type double. @since JDK1.1

Class Error

An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error though a "normal" condition is also a subclass of Error because most applications should not try to catch it.

A method is not required to declare in its throws clause any subclasses of Error that might be thrown during the execution of the method but not caught since these errors are abnormal conditions that should never occur. @author Frank Yellin @version 1.12 0214 12/0203/0001 @see java.lang.ThreadDeath @since JDK1.0

Class Error, constructor Error()

Constructs ana Errornew error with nonull as specifiedits detail message. The cause is not initialized and may subsequently be initialized by a call to #initCause
Class Error, constructor Error(String)

Constructs an Errora new error with the specified detail message. The cause is not initialized and may subsequently be initialized by a call to #initCause @param smessage the detail message. The detail message is saved for later retrieval by the #getMessage() method.

Class Exception

The class Exception and its subclasses are a form of Throwable that indicates conditions that a reasonable application might want to catch. @author Frank Yellin @version 1.27 0229 12/0203/0001 @see java.lang.Error @since JDK1.0
Class Exception, constructor Exception()

Constructs ana Exceptionnew exception with nonull as specifiedits detail message. The cause is not initialized and may subsequently be initialized by a call to #initCause
Class Exception, constructor Exception(String)

Constructs ana Exceptionnew exception with the specified detail message. The cause is not initialized and may subsequently be initialized by a call to #initCause @param smessage the detail message. The detail message is saved for later retrieval by the #getMessage() method.

Class ExceptionInInitializerError

Signals that an unexpected exception has occurred in a static initializer. An ExceptionInInitializerError is thrown to indicate that an exception occurred during evaluation of a static initializer or the initializer for a static variable.

As of release 1.4 this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "saved throwable object" that may be provided at construction time and accessed via the #getException() method is now known as the cause and may be accessed via the Throwable#getCause() method as well as the aforementioned "legacy method." @author Frank Yellin @version 1.11 0215 12/0203/0001 @since JDK1.1

Class ExceptionInInitializerError, constructor ExceptionInInitializerError()

Constructs an ExceptionInInitializerError with null as its detail message string and with no saved thowablethrowable object. A detail message is a String that describes this particular exception.
Class ExceptionInInitializerError, Throwable getException()

Returns the exception that occurred during a static initialization that caused this Errorerror to be created.

This method predates the general-purpose exception chaining facility. The Throwable#getCause() method is now the preferred means of obtaining this information. @return the saved throwable object of this ExceptionInInitializerError or null if this ExceptionInInitializerError has no saved throwable object.


Class Float

The Float class wraps a value of primitive type float in an object. An object of type Float contains a single field whose type is float.

In addition this class provides several methods for converting a float to a String and a String to a float as well as other constants and methods useful when dealing with a float. @author Lee Boynton @author Arthur van Hoff @version 1.60 0277 12/0203/0001 @since JDK1.0

Class Float, constructor Float(double)

Constructs a newly allocated Float object that represents the argument converted to type float. @param value the value to be represented by the Float.
Class Float, byte byteValue()

Returns the value of this Float as a byte (by casting to a byte). @sincereturn JDK1.1the float value represented by this object converted to type byte
Class Float, int compareTo(Float)

Compares two FloatsFloat objects numerically. There are two ways in which comparisons performed by this method differ from those performed by the Java language numerical comparison operators (< <= == >= >) when applied to primitive floatsfloat values: This ensures that Float.compareTo(Object) (which inheritsforwards its behavior fromto this method) obeys the general contract for Comparable.compareTo and that the natural order on FloatsFloats is totalconsistent with equals. @param anotherFloat the Float to be compared. @return the value 0 if anotherFloat is numerically equal to this Float; a value less than 0 if this Float is numerically less than anotherFloat; and a value greater than 0 if this Float is numerically greater than anotherFloat. @since 1.2 @see Comparable#compareTo(Object)
Class Float, int compareTo(Object)

Compares this Float object to another Objectobject. If the Objectobject is a Float this function behaves like compareTo(Float). Otherwise it throws a ClassCastException (as FloatsFloat objects are comparable only to other FloatsFloat objects). @param o the Object to be compared. @return the value 0 if the argument is a Float numerically equal to this Float; a value less than 0 if the argument is a Float numerically greater than this Float; and a value greater than 0 if the argument is a Float numerically less than this Float . @exception ClassCastException if the argument is not a Float. @see java.lang.Comparable @since 1.2
Class Float, double doubleValue()

Returns the double value of this Float object. @return the float value represented by this object is converted to type double and the result of the conversion is returned.
Class Float, boolean equals(Object)

Compares this object against some otherthe specified object. The result is true if and only if the argument is not null and is a Float object that represents a float that has the identical bit pattern towith the bit pattern ofsame value as the float represented by this object. For this purpose two float values are considered to be the same if and only if the method #floatToIntBits(float) returns the sameidentical int value when applied to each.

Note that in most cases for two instances of class Float f1 and f2 the value of f1.equals(f2) is true if and only if

 f1.floatValue() == f2.floatValue() 

also has the value true. However there are two exceptions:

This definition allows hashtableshash tables to operate properly. @param obj the object to be compared @return true if the objects are the same; false otherwise. @see java.lang.Float#floatToIntBits(float)
Class Float, int floatToIntBits(float)

Returns the bit represention of a single-float value. The result is a representation of the specified floating-point argumentvalue according to the IEEE 754 floating-point "single precisionformat" bit layout.

Bit 31 (the bit that is selected by the mask 0x80000000) represents the sign of the floating-point number. Bits 30-23 (the bits that are selected by the mask 0x7f800000) represent the exponent. Bits 22-0 (the bits that are selected by the mask 0x007fffff) represent the significand (sometimes called the mantissa) of the floating-point number.

If the argument is positive infinity the result is 0x7f800000.

If the argument is negative infinity the result is 0xff800000.

If the argument is NaN the result is 0x7fc00000.

In all cases the result is an integer that when given to the #intBitsToFloat(int) method will produce a floating-point value equalthe same toas the argument to floatToIntBits (except all NaN values are collapsed to a single "canonical" NaN value). @param value a floating-point number. @return the bits that represent the floating-point number.

Class Float, int floatToRawIntBits(float)

Returns the bit represention of a single-float value. The result is a representation of the specified floating-point argumentvalue according to the IEEE 754 floating-point "single precisionformat" bit layout preserving Not-a-Number (NaN) values.

Bit 31 (the bit that is selected by the mask 0x80000000) represents the sign of the floating-point number. Bits 30-23 (the bits that are selected by the mask 0x7f800000) represent the exponent. Bits 22-0 (the bits that are selected by the mask 0x007fffff) represent the significand (sometimes called the mantissa) of the floating-point number.

If the argument is positive infinity the result is 0x7f800000.

If the argument is negative infinity the result is 0xff800000.

If the argument is NaN the result is the integer representing the actual NaN value. Unlike the floatToIntBits method intToRawIntBits does not collapse all the bit patterns encoding a NaN valuesto a single "canonical" NaN value.

In all cases the result is an integer that when given to the #intBitsToFloat(int) method will produce a floating-point value equalthe tosame as the argument to floatToRawIntBits. @param value a floating-point number. @return the bits that represent the floating-point number.

Class Float, float floatValue()

Returns the float value of this Float object. @return the float value represented by this object.
Class Float, int hashCode()

Returns a hashcodehash code for this Float object. The result is the integer bit representation exactly as produced by the method #floatToIntBits(float) of the primitive float value represented by this Float object. @return a hash code value for this object.
Class Float, float intBitsToFloat(int)

Returns the single-float value corresponding to a given bit represention. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "single precisionformat" bit layout.

If the argument is 0x7f800000 the result is positive infinity.

If the argument is 0xff800000 the result is negative infinity.

If the argument is any value in the range 0x7f800001 through 0x7fffffff or in the range 0xff800001 through 0xffffffff the result is a NaN. AllNo IEEE 754 NaN values of typefloating-point floatoperation are in effect lumped together by the Java programming language into a singleprovided by Java can distinguish between two NaN values of the same type floatwith value called NaNdifferent bit patterns. Distinct values of NaN are only accessibledistinguishable by use of the Float.floatToRawIntBits method.

In all other cases let s e and m be three values that can be computed from the argument:

 int s = ((bits >> 31) == 0) 1 : -1; int e = ((bits >> 23) & 0xff); int m = (e == 0) (bits & 0x7fffff) << 1 : (bits & 0x7fffff) | 0x800000; 
Then the floating-point result equals the value of the mathematical expression s&#183middot;m&#183middot;2e-150. @param bits an integer. @return the single-formatfloat floating-point value with the same bit pattern.
Class Float, int intValue()

Returns the integer value of this Float as an int (by casting to antype int). @return the float value represented by this object converted to type int and the result of the conversion is returned.
Class Float, boolean isInfinite()

Returns true if this Float value is infinitely large in magnitude false otherwise. @return true if the value represented by this object is positive infinity or negative infinity; false otherwise.
Class Float, boolean isInfinite(float)

Returns true if the specified number is infinitely large in magnitude false otherwise. @param v the value to be tested. @return true if the argument is positive infinity or negative infinity; false otherwise.
Class Float, boolean isNaN()

Returns true if this Float value is a Not-a-Number (NaN) false otherwise. @return true if the value represented by this object is NaN; false otherwise.
Class Float, boolean isNaN(float)

Returns true if the specified number is the speciala Not-a-Number (NaN) value false otherwise. @param v the value to be tested. @return true if the argument is NaN; false otherwise.
Class Float, long longValue()

Returns the long value of this Float as a long (by casting to atype long). @return the float value represented by this object is converted to type long and the result of the conversion is returned.
Class Float, float parseFloat(String)

Returns a new float initialized to the value represented by the specified String as performed by the valueOf method of class DoubleFloat. @param s the string to be parsed. @return the float value represented by the string argument. @exception NumberFormatException if the string does not contain a parsable float. @see java.lang.DoubleFloat#valueOf(String) @since 1.2
Class Float, short shortValue()

Returns the value of this Float as a short (by casting to a short). @return the float value represented by this object converted to type short @since JDK1.1
Class Float, String toString()

Returns a Stringstring representation of this Float object. The primitive float value represented by this object is converted to a String exactly as if by the method toString of one argument. @return a String representation of this object. @see java.lang.Float#toString(float)
Class Float, String toString(float)

Returns a Stringstring representation forof the specified float value. The argument is converted to a readable string format as follows. All characters and characters in strings mentioned below are ASCII characters. How many digits must be printed for the fractional part of m or a There must be at least one digit to represent the fractional part and beyond that as many but only as many more digits as are needed to uniquely distinguish the argument value from adjacent values of type float. That is suppose that x is the exact mathematical value represented by the decimal representation produced by this method for a finite nonzero argument f. Then f must be the float value nearest to x; or if two float values are equally close to x then f must be one of them and the least significant bit of the significand of f must be 0.

To create localized string representations of a floating-point value use subclasses of java.text.NumberFormat @param f the float to be converted. @return a string representation of the argument.

Class Float, Float valueOf(String)

Returns the floating pointa valueFloat represented byobject holding the specified String. The string sfloat isvalue interpreted asrepresented by the representation of a floating-point value andargument astring Floats object representing that value is created and returned.

If s is null then a NullPointerException is thrown.

Leading and trailing whitespace characters in s are ignored. The rest of s should constitute a FloatValue as described by the lexical syntax rules:

FloatValue:
Signopt NaN
Signopt Infinity
Signopt FloatingPointLiteral
where Sign and FloatingPointLiteral are as defined in #§3.10.2 of the Java Language Specification. If its does not have the form of a FloatValue then a NumberFormatException is thrown. Otherwise its is regarded as representing an exact decimal value in the usual "computerized scientific notation"; this exact decimal value is then conceptually converted to an "infinitely precise" binary value that is then rounded to type float by the usual round-to-nearest rule of IEEE 754 floating-point arithmetic which includes preserving the sign of a zero value. Finally a Float object representing this float value is returned.

To interpret localized string representations of a floating-point value use subclasses of java.text.NumberFormat @param s the string to be parsed. @return a newly constructed Float initialized toobject holding the value represented by the String argument. @exception NumberFormatException if the string does not contain a parsable number.

Class Float, float MAX_VALUE

TheA constant holding the largest positive finite value of type float. It is equal to the value returned by Float.intBitsToFloat(0x7f7fffff).
Class Float, float MIN_VALUE

TheA constant holding the smallest positive nonzero value of type float. It is equal to the value returned by Float.intBitsToFloat(0x1).
Class Float, float NEGATIVE_INFINITY

TheA constant holding the negative infinity of type float. It is equal to the value returned by Float.intBitsToFloat(0xff800000).
Class Float, float NaN

TheA constant holding a Not-a-Number (NaN) value of type float. It is equalequivalent to the value returned by Float.intBitsToFloat(0x7fc00000).
Class Float, float POSITIVE_INFINITY

TheA constant holding the positive infinity of type float. It is equal to the value returned by Float.intBitsToFloat(0x7f800000).
Class Float, Class TYPE

The Class objectinstance representing the primitive type float. @since JDK1.1

Class IllegalAccessError

Thrown if an application attempts to access or modify a field or to call a method that it does not have access to.

Normally this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed. @author unascribed @version 1.13 0214 12/0203/0001 @since JDK1.0


Class IllegalAccessException

ThrownAn IllegalAccessException is thrown when an application tries to loadreflectively create an instance (other than an array) set or inget a classfield or invoke a method but the currently executing method does not have access to the definition of the specified class because the class is not publicfield and inmethod another packageor constructor. An instance of@author thisunascribed class@version can1.12 also12/03/01 be@see thrownClass#newInstance() when@see anjava.lang.reflect.Field#set(Object applicationObject) tries@see tojava.lang.reflect.Field#setBoolean(Object createboolean) an@see instancejava.lang.reflect.Field#setByte(Object ofbyte) a@see classjava.lang.reflect.Field#setShort(Object usingshort) the@see newInstancejava.lang.reflect.Field#setChar(Object methodchar) in@see classjava.lang.reflect.Field#setInt(Object Classint) but@see thejava.lang.reflect.Field#setLong(Object currentlong) method@see doesjava.lang.reflect.Field#setFloat(Object notfloat) have@see accessjava.lang.reflect.Field#setDouble(Object todouble) the@see appropriatejava.lang.reflect.Field#get(Object) zero-argument@see constructorjava.lang.reflect.Field#getBoolean(Object) @authorsee unascribedjava.lang.reflect.Field#getByte(Object) @version 1see java.9 02/02/00lang.reflect.Field#getShort(Object) @see java.lang.Classreflect.Field#forNamegetChar(Object) @see java.lang.Stringreflect.Field#getInt(Object) @see java.lang.Classreflect.Field#newInstancegetLong(Object) @see java.lang.ClassLoaderreflect.Field#findSystemClassgetFloat(Object) @see java.lang.Stringreflect.Field#getDouble(Object) @see java.lang.ClassLoaderreflect.Method#loadClassinvoke(Object Object[]) @see java.lang.String booleanreflect.Constructor#newInstance(Object[]) @since JDK1.0

Class IllegalArgumentException

Thrown to indicate that a method has been passed an illegal or inappropriate argument. @author unascribed @version 1.17 0218 12/0203/0001 @see java.lang.Thread#setPriority(int) @since JDK1.0

Class IllegalMonitorStateException

Thrown to indicate that a thread has attempted to wait on an object's monitor or to notify other threads waiting on an object's monitor without owning the specified monitor. @author unascribed @version 1.9 0210 12/0203/0001 @see java.lang.Object#notify() @see java.lang.Object#notifyAll() @see java.lang.Object#wait() @see java.lang.Object#wait(long) @see java.lang.Object#wait(long int) @since JDK1.0

Class IllegalStateException

Signals that a method has been invoked at an illegal or inappropriate time. In other words the Java environment or Java application is not in an appropriate state for the requested operation. @author Jonni Kanerva @version 1.9 0210 12/0203/0001 @since JDK1.1

Class IllegalThreadStateException

Thrown to indicate that a thread is not in an appropriate state for the requested operation. See for example the suspend and resume methods in class Thread. @author unascribed @version 1.18 0219 12/0203/0001 @see java.lang.Thread#resume() @see java.lang.Thread#suspend() @since JDK1.0

Class IncompatibleClassChangeError

Thrown when an incompatible class change has occurred to some class definition. The definition of some class on which the currently executing method depends has since changed. @author unascribed @version 1.15 0216 12/0203/0001 @since JDK1.0

Class IndexOutOfBoundsException

Thrown to indicate that an index of some sort (such as to an array to a string or to a vector) is out of range.

Applications can subclass this class to indicate similar exceptions. @author Frank Yellin @version 1.8 029 12/0203/0001 @since JDK1.0


Class InheritableThreadLocal

This class extends ThreadLocal to provide inheritance of values from parent Threadthread to child Threadthread: when a child thread is created the child receives initial values for all InheritableThreadLocalsinheritable thread-local variables for which the parent has values. Normally the child's values will be identical to the parent's; however the child's value can be made an arbitrary function of the parent's by overriding the childValue method in this class.

InheritableThreadLocalInheritable thread-local variables are used in preference to ordinary ThreadLocalthread-local variables when the per-thread-attribute being maintained in the variable (e.g. User ID Transaction ID) must be automatically transmitted to any child threads that are created. @author Josh Bloch and Doug Lea @version 1.10 0215 12/0203/0001 @see ThreadLocal @since 1.2

Class InheritableThreadLocal, Object childValue(Object)

Computes the child's initial value for this InheritableThreadLocalinheritable thread-local variable as a function of the parent's value at the time the child Threadthread is created. This method is called from within the parent thread before the child is started.

This method merely returns its input argument and should be overridden if a different behavior is desired. @param parentValue the parent thread's value @return the child thread's initial value

Class InheritableThreadLocal, Object get()

Returns the value in the callingcurrent thread's copy of this ThreadLocalthread-local variable. Creates and initializes the copy if this is the first time the thread has called this method. @return the current thread's value of this thread-local
Class InheritableThreadLocal, void set(Object)

Sets the callingcurrent thread's instancecopy of this ThreadLocalthread-local variable to the givenspecified value. This is only used to change the value from the one assigned by the initialValue method and many applications will have no need for this functionality. @param value the value to be stored in the callingcurrent threads' copy of this ThreadLocalthread-local.

Class InstantiationError

Thrown when an application tries to use the Java new construct to instantiate an abstract class or an interface.

Normally this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed. @author unascribed @version 1.9 0210 12/0203/0001 @since JDK1.0


Class InstantiationException

Thrown when an application tries to create an instance of a class using the newInstance method in class Class but the specified class object cannot be instantiated because it is an interface or is an abstract class. @author unascribed @version 1.14 0215 12/0203/0001 @see java.lang.Class#newInstance() @since JDK1.0

Class Integer

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

In addition this class provides several methods for converting an int to a String and a String to an int as well as other constants and methods useful when dealing with an int. @author Lee Boynton @author Arthur van Hoff @version 1.64 0273 12/0903/01 @since JDK1.0

Class Integer, constructor Integer(String)

Constructs a newly allocated Integer object that represents the int value representedindicated by the stringString parameter. The string is converted to an int value in exactly the manner used by the parseInt method for radix 10. @param s the String to be converted to an Integer. @exception NumberFormatException if the String does not contain a parsable integer. @see java.lang.Integer#parseInt(java.lang.String int)
Class Integer, constructor Integer(int)

Constructs a newly allocated Integer object that represents the primitivespecified int argumentvalue. @param value the value to be represented by the Integer object.
Class Integer, byte byteValue()

Returns the value of this Integer as a byte. @since JDK1.1
Class Integer, int compareTo(Integer)

Compares two IntegersInteger objects numerically. @param anotherInteger the Integer to be compared. @return the value 0 if the argumentthis Integer is equal to thisthe argument Integer; a value less than 0 if this Integer is numerically less than the Integer argument Integer; and a value greater than 0 if this Integer is numerically greater than the Integer argument Integer (signed comparison). @since 1.2
Class Integer, int compareTo(Object)

Compares this Integer object to another Objectobject. If the Objectobject is aan Integer this function behaves like compareTo(Integer). Otherwise it throws a ClassCastException (as IntegersInteger are comparableobjects are only comparable to other IntegersInteger objects). @param o the Object to be compared. @return the value 0 if the argument is a Integer numerically equal to this Integer; a value less than 0 if the argument is a Integer numerically greater than this Integer; and a value greater than 0 if the argument is a Integer numerically less than this Integer. @exception ClassCastException if the argument is not an Integer. @see java.lang.Comparable @since 1.2
Class Integer, Integer decode(String)

Decodes a String into an Integer. Accepts decimal hexadecimal and octal numbers innumbers given by the following formatsgrammar: [-]
decimal
constant
DecodableString: [-]
Signopt DecimalNumeral
Signopt 0x hexHexDigits
Signopt constant0X [-]HexDigits
Signopt # HexDigits
Signopt hex0 constantOctalDigits

Sign: [
-] 0
octal
DecimalNumeral HexDigits constantand OctalDigits are defined in §3.10.1 of the Java Language Specification.

The constantsequence of characters following an (optional) negative sign and/or "radix specifier" ("0x" "0X" "#" or leading zero) is parsed as by the Integer.parseInt method with the specifiedindicated radix (10 816 or 168). This constantsequence of characters must berepresent a positive value or a NumberFormatException will resultbe thrown. The result is made negativenegated if first character of the specified String is the negativeminus sign. No whitespace characters are permitted in the String. @param nm the String to decode. @return thea Integer represented byobject holding the specifiedint string.value represented by nm @exception NumberFormatException if the String does not contain a parsable integer. @see java.lang.Integer#parseInt(java.lang.String int) @since 1.2

Class Integer, double doubleValue()

Returns the value of this Integer as a double. @return the int value represented by this object is converted to type double and the result of the conversion is returned.
Class Integer, float floatValue()

Returns the value of this Integer as a float. @return the int value represented by this object is converted to type float and the result of the conversion is returned.
Class Integer, Integer getInteger(String)

Determines the integer value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through the java.lang.System#getProperty(java.lang.String) method. The string value of this property is then interpreted as an integer value and an Integer object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty.

If there is no property with the specified name if the specified name is empty or null or if the property does not have the correct numeric format then null is returned.

In other words this method returns an Integer object equal to the value of:

getInteger(nm null)
@param nm property name. @return the Integer value of the property. @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String java.lang.String)
Class Integer, Integer getInteger(String, Integer)

Returns the integer value of the system property with the specified name. The first argument is treated as the name of a system property. System properties are accessible through getProperty a method defined by the java.lang.System#getProperty(java.lang.String) classmethod. The string value of this property is then interpreted as an integer value as per the Integer.decode method and an Integer object representing this value is returned.

The second argument is the default value. The default value is returned if there is no property of the specified name if the property does not have the correct numeric format or if the specified name is empty or null. @param nm property name. @param val default value. @return the Integer value of the property. @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String java.lang.String) @see java.lang.Integer#decode

Class Integer, Integer getInteger(String, int)

Determines the integer value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through getProperty a method defined by the java.lang.System#getProperty(java.lang.String) classmethod. The string value of this property is then interpreted as an integer value and an Integer object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty.

The second argument is the default value. An Integer object that represents the value of the second argument is returned if there is no property of the specified name if the property does not have the correct numeric format or if the specified name is empty or null.

In other words this method returns an Integer object equal to the value of:

getInteger(nm new Integer(val))
but in practice it may be implemented in a manner such as:
 Integer result = getInteger(nm null); return (result == null) new Integer(val) : result; 
to avoid the unnecessary allocation of an Integer object when the default value is not needed. @param nm property name. @param val default value. @return the Integer value of the property. @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String java.lang.String)
Class Integer, int hashCode()

Returns a hashcodehash code for this Integer. @return a hash code value for this object equal to the primitive int value represented by this Integer object.
Class Integer, int intValue()

Returns the value of this Integer as an int. @return the int value represented by this object.
Class Integer, long longValue()

Returns the value of this Integer as a long. @return the int value represented by this object that is converted to type long and the result of the conversion is returned.
Class Integer, int parseInt(String)

Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits except that the first character may be an ASCII minus sign '-' ('\u002du002D') to indicate a negative value. The resulting integer value is returned exactly as if the argument and the radix 10 were given as arguments to the int) method. @param s a string.String containing the int representation to be parsed @return the integer value represented by the argument in decimal. @exception NumberFormatException if the string does not contain a parsable integer.
Class Integer, int parseInt(String, int)

Parses the string argument as a signed integer in the radix specified by the second argument. The characters in the string must all be digits of the specified radix (as determined by whether int) returns a nonnegative value) except that the first character may be an ASCII minus sign '-' ('\u002du002D') to indicate a negative value. The resulting integer value is returned.

An exception of type NumberFormatException is thrown if any of the following situations occurs:

Examples:

 parseInt("0" 10) returns 0 parseInt("473" 10) returns 473 parseInt("-0" 10) returns 0 parseInt("-FF" 16) returns -255 parseInt("1100110" 2) returns 102 parseInt("2147483647" 10) returns 2147483647 parseInt("-2147483648" 10) returns -2147483648 parseInt("2147483648" 10) throws a NumberFormatException parseInt("99" 8) throws a NumberFormatException parseInt("Kona" 10) throws a NumberFormatException parseInt("Kona" 27) returns 411787 
@param s the String containing the integer. representation to be parsed @param radix the radix to be used while parsing s. @return the integer represented by the string argument in the specified radix. @exception NumberFormatException if the stringString does not contain a parsable integerint.
Class Integer, short shortValue()

Returns the value of this Integer as a short. @since JDK1.1
Class Integer, String toBinaryString(int)

CreatesReturns a string representation of the integer argument as an unsigned integer in base 2.

The unsigned integer value is the argument plus 232 if the argument is negative; otherwise it is equal to the argument. This value is converted to a string of ASCII digits in binary (base 2) with no extra leading 0s. If the unsigned magnitude is zero it is represented by a single zero character '0' ('\u0030'); otherwise the first character of the representation of the unsigned magnitude will not be the zero character. The characters '0' ('\u0030') and '1' ('\u0031') are used as binary digits. @param i an integer to be converted to a string. @return the string representation of the unsigned integer value represented by the argument in binary (base 2). @since JDK1.0.2

Class Integer, String toHexString(int)

CreatesReturns a string representation of the integer argument as an unsigned integer in base 16.

The unsigned integer value is the argument plus 232 if the argument is negative; otherwise it is equal to the argument. This value is converted to a string of ASCII digits in hexadecimal (base 16) with no extra leading 0s. If the unsigned magnitude is zero it is represented by a single zero character '0' ('\u0030'); otherwise the first character of the representation of the unsigned magnitude will not be the zero character. The following characters are used as hexadecimal digits:

 0123456789abcdef 
These are the characters '\u0030' through '\u0039' and 'u\0039\u0061' through '\u0066'. If the uppercase letters are desired the java.lang.String#toUpperCase() method may be called on the result:
 LongInteger.toHexString(n).toUpperCase() 
@param i an integer to be converted to a string. @return the string representation of the unsigned integer value represented by the argument in hexadecimal (base 16). @since JDK1.0.2
Class Integer, String toOctalString(int)

CreatesReturns a string representation of the integer argument as an unsigned integer in base  8.

The unsigned integer value is the argument plus 232 if the argument is negative; otherwise it is equal to the argument. This value is converted to a string of ASCII digits in octal (base 8) with no extra leading 0s.

If the unsigned magnitude is zero it is represented by a single zero character '0' ('\u0030'); otherwise the first character of the representation of the unsigned magnitude will not be the zero character. The octal digitsfollowing characters are used as octal digits:

 01234567 
These are the characters '\u0030' through '\u0037'. @param i an integer to be converted to a string. @return the string representation of the unsigned integer value represented by the argument in octal (base 8). @since JDK1.0.2
Class Integer, String toString()

Returns a String object representing this Integer's value. The value is converted to signed decimal representation and returned as a string exactly as if the integer value were given as an argument to the java.lang.Integer#toString(int) method. @return a string representation of the value of this object in base 10.
Class Integer, String toString(int)

Returns a new String object representing the specified integer. The argument is converted to signed decimal representation and returned as a string exactly as if the argument and radix 10 were given as arguments to the int) method. @param i an integer to be converted. @return a string representation of the argument in base 10.
Class Integer, String toString(int, int)

CreatesReturns a string representation of the first argument in the radix specified by the second argument.

If the radix is smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX then the radix 10 is used instead.

If the first argument is negative the first element of the result is the ASCII minus character '-' ('\u002du002D'). If the first argument is not negative no sign character appears in the result.

The remaining characters of the result represent the magnitude of the first argument. If the magnitude is zero it is represented by a single zero character '0' ('\u0030'); otherwise the first character of the representation of the magnitude will not be the zero character. The following ASCII characters are used as digits:

 0123456789abcdefghijklmnopqrstuvwxyz 
These are '\u0030' through '\u0039' and '\u0061' through '\u007au007A'. If the radix is N then the first N of these characters are used as radix-N digetsdigits in the order shown. Thus the digits for hexadecimal (radix 16) are 0123456789abcdef. If uppercase letters are desired the java.lang.String#toUpperCase() method may be called on the result:
 Integer.toString(n 16).toUpperCase() 
@param i an integer to be converted to a string. @param radix the radix to use in the string representation. @return a string representation of the argument in the specified radix. @see java.lang.Character#MAX_RADIX @see java.lang.Character#MIN_RADIX
Class Integer, Integer valueOf(String)

Returns a newan Integer object initializedholding to the value of the specified String. The argument is interpreted as representing a signed decimal integer exactly as if the argument were given to the #parseInt(java.lang.String) method. The result is an Integer object that represents the integer value specified by the string.

In other words this method returns an Integer object equal to the value of:

new Integer(Integer.parseInt(s))
@param s the string to be parsed. @return a newly constructedan Integer initialized toobject holding the value represented by the string argument. @exception NumberFormatException if the string cannot be parsed as an integer.
Class Integer, Integer valueOf(String, int)

Returns a newan Integer object initialized toholding the value ofextracted from the specified String when parsed with the radix given by the second argument. The first argument is interpreted as representing a signed integer in the radix specified by the second argument exactly as if the arguments were given to the int) method. The result is an Integer object that represents the integer value specified by the string.

In other words this method returns an Integer object equal to the value of:

new Integer(Integer.parseInt(s radix))
@param s the string to be parsed. @param radix the radix of theto integer represented by string be used in interpreting s @return a newly constructedan Integer initialized toobject holding the value represented by the string argument in the specified radix. @exception NumberFormatException if the String cannot be parsed as andoes not contain a parsable int.
Class Integer, int MAX_VALUE

TheA largest value of typeconstant int.holding The constantthe maximum value ofan thisint field iscan have 2147483647231-1.
Class Integer, int MIN_VALUE

TheA smallest value of typeconstant int.holding The constantthe minimum value ofan thisint field iscan have -2147483648231.
Class Integer, Class TYPE

The Class objectinstance representing the primitive type int. @since JDK1.1

Class InternalError

Thrown to indicate some unexpected internal error has occurred in the Java Virtual Machine. @author unascribed @version 1.18 0219 12/0203/0001 @since JDK1.0

Class InterruptedException

Thrown when a thread is waiting sleeping or otherwise paused for a long time and another thread interrupts it using the interrupt method in class Thread. @author Frank Yellin @version 1.12 0213 12/0203/0001 @see java.lang.Object#wait() @see java.lang.Object#wait(long) @see java.lang.Object#wait(long int) @see java.lang.Thread#sleep(long) @see java.lang.Thread#interrupt() @see java.lang.Thread#interrupted() @since JDK1.0

Class LinkageError

Subclasses of LinkageError indicate that a class has some dependency on another class; however the latter class has incompatibly changed after the compilation of the former class. @author Frank Yellin @version 1.10 0211 12/0203/0001 @since JDK1.0

Class Long

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

In addition this class provides several methods for converting a long to a String and a String to a long as well as other constants and methods useful when dealing with a long. @author Lee Boynton @author Arthur van Hoff @version 1.52 0262 12/0203/0001 @since JDK1.0

Class Long, constructor Long(String)

Constructs a newly allocated Long object that represents the long value representedindicated by the string in decimalString formparameter. The string is converted to ana long value as ifin exactly the manner used by the int)parseLong method for radix 10. @param s the stringString to be converted to a Long. @exception NumberFormatException if the String does not contain a parsable long integer. @see java.lang.Long#valueOf(java.lang.String)
Class Long, constructor Long(long)

Constructs a newly allocated Long object that represents the primitivespecified long argument. @param value the value to be represented by the Long object.
Class Long, byte byteValue()

Returns the value of this Long as a byte. @since JDK1.1
Class Long, int compareTo(Long)

Compares two LongsLong objects numerically. @param anotherLong the Long to be compared. @return the value 0 if the argumentthis Long is equal to thisthe argument Long; a value less than 0 if this Long is numerically less than the Long argument Long; and a value greater than 0 if this Long is numerically greater than the Long argument Long (signed comparison). @since 1.2
Class Long, int compareTo(Object)

Compares this Long object to another Objectobject. If the Objectobject is a Long this function behaves like compareTo(Long). Otherwise it throws a ClassCastException (as LongsLong objects are comparable only to other LongsLong objects). @param o the Object to be compared. @return the value 0 if the argument is a Long numerically equal to this Long; a value less than 0 if the argument is a Long numerically greater than this Long; and a value greater than 0 if the argument is a Long numerically less than this Long. @exception ClassCastException if the argument is not a Long. @see java.lang.Comparable @since 1.2
Class Long, Long decode(String)

Decodes a String into a Long. Accepts decimal hexadecimal and octal numbers ingiven by the following formatsgrammar: [-]
decimal
constant
DecodableString: [-]
Signopt DecimalNumeral
Signopt 0x hexHexDigits
Signopt constant0X [-]HexDigits
Signopt # HexDigits
Signopt hex0 constantOctalDigits

Sign: [
-] 0
octal
DecimalNumeral HexDigits and OctalDigits are defined in §3.10.1 of constantthe Java Language Specification.

The constantsequence of characters following an (optional) negative sign and/or "radix specifier" ("0x" "0X" "#" or leading zero) is parsed as by the Long.parseLong method with the specifiedindicated radix (10 816 or 168). This constantsequence of characters must berepresent a positive value or a NumberFormatException will resultbe thrown. The result is madenegated negative if first character of the specified String is the negativeminus sign. No whitespace characters are permitted in the String. @param nm the String to decode. @return thea Long represented byobject holding the specifiedlong string.value represented by nm @exception NumberFormatException if the String does not contain a parsable long. @see java.lang.Long#parseLong(String int) @since 1.2

Class Long, double doubleValue()

Returns the value of this Long as a double. @return the long value represented by this object that is converted to type double and the result of the conversion is returned.
Class Long, boolean equals(Object)

Compares this object againstto the specified object. The result is true if and only if the argument is not null and is a Long object that contains the same long value as this object. @param obj the object to compare with. @return true if the objects are the same; false otherwise.
Class Long, float floatValue()

Returns the value of this Long as a float. @return the long value represented by this object is converted to type float and the result of the conversion is returned.
Class Long, Long getLong(String)

Determines the long value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through the java.lang.System#getProperty(java.lang.String) method. The string value of this property is then interpreted as a long value and a Long object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty.

If there is no property with the specified name if the specified name is empty or null or if the property does not have the correct numeric format then null is returned.

In other words this method returns a Long object equal to the value of:

getLong(nm null)
@param nm property name. @return the Long value of the property. @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String java.lang.String)
Class Long, Long getLong(String, Long)

Returns the long value of the system property with the specified name. The first argument is treated as the name of a system property. System properties are accessible through the java.lang.System#getProperty(java.lang.String) method. The string value of this property is then interpreted as a long value as per the Long.decode method and a Long object representing this value is returned.

Note that in every case neither L ('\u004C') nor l ('\u006C') is permitted to appear at the end of the property value as a type indicator as would be permitted in Java programming language source code.

The second argument is the default value. The default value is returned if there is no property of the specified name if the property does not have the correct numeric format or if the specified name is empty or null. @param nm property name. @param val default value. @return the Long value of the property. @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String java.lang.String) @see java.lang.Long#decode

Class Long, Long getLong(String, long)

Determines the long value of the system property with the specified name.

The first argument is treated as the name of a system property. System properties are accessible through the java.lang.System#getProperty(java.lang.String) method. The string value of this property is then interpreted as a long value and a Long object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty.

The second argument is the default value. A Long object that represents the value of the second argument is returned if there is no property of the specified name if the property does not have the correct numeric format or if the specified name is empty or null.

In other words this method returns a Long object equal to the value of:

getLong(nm new Long(val))
but in practice it may be implemented in a manner such as:
 Long result = getLong(nm null); return (result == null) new Long(val) : result; 
to avoid the unnecessary allocation of a Long object when the default value is not needed. @param nm property name. @param val default value. @return the Long value of the property. @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String java.lang.String)
Class Long, int hashCode()

ComputesReturns a hashcodehash code for this Long. The result is the exclusive OR of the two halves of the primitive long value representedheld by this Long object. That is the hashcode is the value of the expression:
 (int)(this.longValue()^(this.longValue()>>>32)) 
@return a hash code value for this object.
Class Long, int intValue()

Returns the value of this Long as an int. @return the long value represented by this object is converted to type int and the result of the conversion is returned.
Class Long, long longValue()

Returns the value of this Long as a long value. @return the long value represented by this object.
Class Long, long parseLong(String)

Parses the string argument as a signed decimal long. The characters in the string must all be decimal digits except that the first character may be an ASCII minus sign '-' (\u002du002D') to indicate a negative value. The resulting long value is returned exactly as if the argument and the radix 10 were given as arguments to the int) method that takes two arguments.

Note that neither the character L ('\u004C') nor l ('\u006C') is permitted to appear at the end of the string as a type indicator as would be permitted in Java programming language source code. @param s a string.String containing the long representation to be parsed @return the long represented by the argument in decimal. @exception NumberFormatException if the string does not contain a parsable long.

Class Long, long parseLong(String, int)

Parses the string argument as a signed long in the radix specified by the second argument. The characters in the string must all be digits of the specified radix (as determined by whether Character.digitint) returns a nonnegative value) except that the first character may be an ASCII minus sign '-' ('\u002du002D') to indicate a negative value. The resulting long value is returned.

Note that neither the character L ('\u004C') nor l ('\u006C') is permitted to appear at the end of the string as a type indicator as would be permitted in Java programming language source code - except that either L or l may appear as a digit for a radix greater than 22.

An exception of type NumberFormatException is thrown if any of the following situations occurs:

Examples:

 parseLong("0" 10) returns 0L parseLong("473" 10) returns 473L parseLong("-0" 10) returns 0L parseLong("-FF" 16) returns -255L parseLong("1100110" 2) returns 102L parseLong("99" 8) throws a NumberFormatException parseLong("Hazelnut" 10) throws a NumberFormatException parseLong("Hazelnut" 36) returns 1356099454469L 
@param s the String containing the long representation to be parsed. @param radix the radix to be used while parsing s. @return the long represented by the string argument in the specified radix. @exception NumberFormatException if the string does not contain a parsable integerlong.
Class Long, short shortValue()

Returns the value of this Long as a short. @since JDK1.1
Class Long, String toBinaryString(long)

CreatesReturns a string representation of the long argument as an unsigned integer in base 2.

The unsigned long value is the argument plus 264 if the argument is negative; otherwise it is equal to the argument. This value is converted to a string of ASCII digits in binary (base 2) with no extra leading 0s. If the unsigned magnitude is zero it is represented by a single zero character '0' ('&392#92;u0030'); otherwise the first character of the representation of the unsigned magnitude will not be the zero character. The characters '0' ('\u0030') and '1' ('\u0031') are used as binary digits. @param i a long to be converted to a string. @return the string representation of the unsigned long value represented by the argument in binary (base 2). @since JDK 1.0.2

Class Long, String toHexString(long)

CreatesReturns a string representation of the long argument as an unsigned integer in base 16.

The unsigned long value is the argument plus 264 if the argument is negative; otherwise it is equal to the argument. This value is converted to a string of ASCII digits in hexadecimal (base 16) with no extra leading 0s. If the unsigned magnitude is zero it is represented by a single zero character '0' ('\u0030'); otherwise the first character of the representation of the unsigned magnitude will not be the zero character. The following characters are used as hexadecimal digits:

 0123456789abcdef 
These are the characters '\u0030' through '\u0039' and '\u0061' through '\u0066'. If uppercase letters are desired the java.lang.String#toUpperCase() method may be called on the result:
 Long.toHexString(n).toUpperCase() 
@param i a long to be converted to a string. @return the string representation of the unsigned long value represented by the argument in hexadecimal (base 16). @since JDK 1.0.2
Class Long, String toOctalString(long)

CreatesReturns a string representation of the long argument as an unsigned integer in base 8.

The unsigned long value is the argument plus 264 if the argument is negative; otherwise it is equal to the argument. This value is converted to a string of ASCII digits in octal (base 8) with no extra leading 0s.

If the unsigned magnitude is zero it is represented by a single zero character '0' ('\u0030'); otherwise the first character of the representation of the unsigned magnitude will not be the zero character. The following characters are used as octal digits:

 01234567 
These are the characters '\u0030' through '\u0037'. @param i a long to be converted to a string. @return the string representation of the unsigned long value represented by the argument in octal (base 8). @since JDK 1.0.2
Class Long, String toString()

Returns a String object representing this Long's value. The long integer value represented by this Long object is converted to signed decimal representation and returned as a string exactly as if the long value were given as an argument to the java.lang.Long#toString(long) method that takes one argument. @return a string representation of the value of this object in base 10.
Class Long, String toString(long)

Returns a new String object representing the specified integerlong. The argument is converted to signed decimal representation and returned as a string exactly as if the argument and the radix 10 were given as arguments to the int) method that takes two arguments. @param i a long to be converted. @return a string representation of the argument in base 10.
Class Long, String toString(long, int)

CreatesReturns a string representation of the first argument in the radix specified by the second argument.

If the radix is smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX then the radix 10 is used instead.

If the first argument is negative the first element of the result is the ASCII minus sign '-' ('\u002d'). If the first argument is not negative no sign character appears in the result.

The remaining characters of the result represent the magnitude of the first argument. If the magnitude is zero it is represented by a single zero character '0' ('\u0030'); otherwise the first character of the representation of the magnitude will not be the zero character. The following ASCII characters are used as digits:

 0123456789abcdefghijklmnopqrstuvwxyz 
These are '\u0030' through '\u0039' and '\u0061' through '\u007a'. If the radix is N then the first N of these characters are used as radix-N digits in the order shown. Thus the digits for hexadecimal (radix 16) are 0123456789abcdef. If uppercase letters are desired the java.lang.String#toUpperCase() method may be called on the result:
 Long.toString(n 16).toUpperCase() 
@param i a longto be converted to a string. @param radix the radix to use in the string representation. @return a string representation of the argument in the specified radix. @see java.lang.Character#MAX_RADIX @see java.lang.Character#MIN_RADIX
Class Long, Long valueOf(String)

Returns a new longLong object initialized toholding the value of the specified String. Throws an exception if the String cannot be parsed as a long. The radix is assumed to be 10. The argument is interpreted as representing a signed decimal integerlong exactly as if the argument were given to the #parseLong(java.lang.String) method that takes one argument). The result is a Long object that represents the integer value specified by the string.

In other words this method returns a Long object equal to the value of:

 new Long(Long.parseLong(s)) 
@param s the string to be parsed. @return a newly constructed Long initialized toobject holding the value represented by the string argument. @exception NumberFormatException If the Stringstring cannot does not containbe parsed as a parsable long.
Class Long, Long valueOf(String, int)

Returns a new longLong object initialized toholding the value ofextracted from the specified String. Throws an exception ifwhen parsed with the String cannotradix be parsed as a longgiven by the second argument. The first argument is interpreted as representing a signed integerlong in the radix specified by the second argument exactly as if the arguments were given to the int) method that takes two arguments. The result is a Long object that represents the integerlong value specified by the string.

In other words this method returns a Long object equal to the value of:

new Long(Long.parseLong(s radix))
@param s the Stringstring containing theto be long.parsed @param radix the radix to be used. in interpreting s @return a newly constructed Long initialized toobject holding the value represented by the string argument in the specified radix. @exception NumberFormatException If the String does not contain a parsable long.
Class Long, long MAX_VALUE

The largestA constant valueholding the ofmaximum value typea long can have 263-1.
Class Long, long MIN_VALUE

The smallestA constant valueholding the ofminimum value typea long can have -263.
Class Long, Class TYPE

The Class objectinstance representing the primitive type long. @since JDK1.1

Class Math

The class Math contains methods for performing basic numeric operations such as the elementary exponential logarithm square root and trigonometric functions.

Unlike some of the numeric functionsmethods of class StrictMath all implementations of the equivalent functions of class Math are not defined to return the bit-for-bit same results. This relaxation permits better-performing implementations where strict reproducibility is not required.

By default many of the Math functionsmethods simply delegatecall to the equivalent functionsmethod in StrictMath for their implementationsimplementation. Code generators are encouraged to use platform-specific native libraries or microprocessor instructions where available to provide higher-performance implementations of Math functionsmethods. Such higher-performance implementations still must conform to the specification for Math.

The quality of implementation specifications concern two properties accuracy of the returned result and monotonicity of the method. Accuracy of the floating-point Math methods is measured in terms of ulps units in the last place. For a given floating-point format an ulp of a specific real number value is the difference between the two floating-point values closest to that numerical value. When discussing the accuracy of a method as a whole rather than at a specific argument the number of ulps cited is for the worst-case error at any argument. If a method always has an error less than 0.5 ulps the method always returns the floating-point number nearest the exact result; such a method is correctly rounded. A correctly rounded method is generally the best a floating-point approximation can be; however it is impractical for many floating-point methods to be correctly rounded. Instead for the Math class a larger error bound of 1 or 2 ulps is allowed for certain methods. Informally with a 1 ulp error bound when the exact result is a representable number the exact result should be returned; otherwise either of the two floating-point numbers closest to the exact result may be returned. Besides accuracy at individual arguments maintaining proper relations between the method at different arguments is also important. Therefore methods with more than 0.5 ulp errors are required to be semi-monotonic: whenever the mathematical function is non-decreasing so is the floating-point approximation likewise whenever the mathematical function is non-increasing so is the floating-point approximation. Not all approximations that have 1 ulp accuracy will automatically meet the monotonicity requirements. @author unascribed @version 1.50 0254 12/0203/0001 @since JDK1.0

Class Math, double abs(double)

Returns the absolute value of a double value. If the argument is not negative the argument is returned. If the argument is negative the negation of the argument is returned. Special cases: In other words the result is equalthe tosame as the value of the expression:

Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1) @param a athe doubleargument whose absolute value. is to be determined @return the absolute value of the argument.

Class Math, float abs(float)

Returns the absolute value of a float value. If the argument is not negative the argument is returned. If the argument is negative the negation of the argument is returned. Special cases: In other words the result is equalthe tosame as the value of the expression:

Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))
@param a athe floatargument whose absolute value. is to be determined @return the absolute value of the argument.
Class Math, int abs(int)

Returns the absolute value of an int value. If the argument is not negative the argument is returned. If the argument is negative the negation of the argument is returned.

Note that if the argument is equal to the value of Integer.MIN_VALUE the most negative representable int value the result is that same value which is negative. @param a anthe intargument whose absolute value. is to be determined @return the absolute value of the argument. @see java.lang.Integer#MIN_VALUE

Class Math, long abs(long)

Returns the absolute value of a long value. If the argument is not negative the argument is returned. If the argument is negative the negation of the argument is returned.

Note that if the argument is equal to the value of Long.MIN_VALUE the most negative representable long value the result is that same value which is negative. @param a athe longargument whose absolute value. is to be determined @return the absolute value of the argument. @see java.lang.Long#MIN_VALUE

Class Math, double acos(double)

Returns the arc cosine of an angle in the range of 0.0 through pi. Special case:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic. @param a the double value whose arc cosine is to be returned. @return the arc cosine of the argument.

Class Math, double asin(double)

Returns the arc sine of an angle in the range of -pi/2 through pi/2. Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic. @param a the double value whose arc sine is to be returned. @return the arc sine of the argument.

Class Math, double atan(double)

Returns the arc tangent of an angle in the range of -pi/2 through pi/2. Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic. @param a the double value whose arc tangent is to be returned. @return the arc tangent of the argument.

Class Math, double atan2(double, double)

Converts rectangular coordinates (bx  ay) to polar (r  theta). This method computes the phase theta by computing an arc tangent of ay/bx in the range of -pi to pi. Special cases:

A result must be within 2 ulps of the correctly rounded result. Results must be semi-monotonic. @param a ay the doubleordinate value.coordinate @param b ax the doubleabscissa value.coordinate @return the theta component of the point (r  theta) in polar coordinates that corresponds to the point (bx  ay) in Cartesian coordinates.

Class Math, double ceil(double)

Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer. Special cases: Note that the value of Math.ceil(x) is exactly the value of -Math.floor(-x). @param a a double value. <--@return the value ⌈ a ⌉.--> @return the smallest (closest to negative infinity) doublefloating-point value that is not less than the argument and is equal to a mathematical integer.
Class Math, double cos(double)

Returns the trigonometric cosine of an angle. Special casecases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic. @param a an angle in radians. @return the cosine of the argument.

Class Math, double exp(double)

Returns the exponentialEuler's number e (i.e. 2.718...) raised to the power of a double value. Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic. @param a athe doubleexponent valueto raise e to. @return the value ea where e is the base of the natural logarithms.

Class Math, double floor(double)

Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer. Special cases: @param a a double value. <--@return the value ⌊ a ⌋.--> @return the largest (closest to positive infinity) doublefloating-point value that is not greater than the argument and is equal to a mathematical integer.
Class Math, double max(double, double)

Returns the greater of two double values. That is the result is the argument closer to positive infinity. If the arguments have the same value the result is that same value. If either value is NaN then the result is NaN. Unlike the the numerical comparison operators this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other negative zero the result is positive zero. @param a a doublean valueargument. @param b a doubleanother valueargument. @return the larger of a and b.
Class Math, float max(float, float)

Returns the greater of two float values. That is the result is the argument closer to positive infinity. If the arguments have the same value the result is that same value. If either value is NaN then the result is NaN. Unlike the the numerical comparison operators this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other negative zero the result is positive zero. @param a a floatan valueargument. @param b a floatanother valueargument. @return the larger of a and b.
Class Math, int max(int, int)

Returns the greater of two int values. That is the result is the argument closer to the value of Integer.MAX_VALUE. If the arguments have the same value the result is that same value. @param a an int valueargument. @param b an intanother valueargument. @return the larger of a and b. @see java.lang.Long#MAX_VALUE
Class Math, long max(long, long)

Returns the greater of two long values. That is the result is the argument closer to the value of Long.MAX_VALUE. If the argumens have the same value the result is that same value. @param a a longan valueargument. @param b a longanother valueargument. @return the larger of a and b. @see java.lang.Long#MAX_VALUE
Class Math, double min(double, double)

Returns the smaller of two double values. That is the result is the value closer to negative infinity. If the arguments have the same value the result is that same value. If either value is NaN then the result is NaN. Unlike the the numerical comparison operators this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other is negative zero the result is negative zero. @param a a doublean valueargument. @param b a doubleanother valueargument. @return the smaller of a and b.
Class Math, float min(float, float)

Returns the smaller of two float values. That is the result is the value closer to negative infinity. If the arguments have the same value the result is that same value. If either value is NaN then the result is NaN. Unlike the the numerical comparison operators this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other is negative zero the result is negative zero. @param a a floatan valueargument. @param b a floatanother valueargument. @return the smaller of a and b.
Class Math, int min(int, int)

Returns the smaller of two int values. That is the result the argument closer to the value of Integer.MIN_VALUE. If the arguments have the same value the result is that same value. @param a an int valueargument. @param b an intanother valueargument. @return the smaller of a and b. @see java.lang.Long#MIN_VALUE
Class Math, long min(long, long)

Returns the smaller of two long values. That is the result is the argument closer to the value of Long.MIN_VALUE. If the arguments have the same value the result is that same value. @param a a longan valueargument. @param b a longanother valueargument. @return the smaller of a and b. @see java.lang.Long#MIN_VALUE
Class Math, double pow(double, double)

Returns of value of the first argument raised to the power of the second argument. Special cases:

(In the foregoing descriptions a floating-point value is considered to be an integer if and only if it is a fixed point of the method ceil or whichequivalently is the same thing a fixed point of the method floor A value is a fixed point of a one-argument method if and only if the result of applying the method to the value is equal to the value.)

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic. @param a a doublethe valuebase. @param b a doublethe valueexponent. @return the value ab.

Class Math, double rint(double)

Returns the double value that is closest in value to athe argument and is equal to a mathematical integer. If two double values that are mathematical integers are equally close to the value of the argument the result is the integer value that is even. Special cases: @param a a double value. @return the closest doublefloating-point value to a that is equal to a mathematical integer.
Class Math, long round(double)

Returns the closest long to the argument. The result is rounded to an integer by adding 1/2 taking the floor of the result and casting the result to type long. In other words the result is equal to the value of the expression:

(long)Math.floor(a + 0.5d)

Special cases:

@param a a doublefloating-point value to be rounded to a long. @return the value of the argument rounded to the nearest long value. @see java.lang.Long#MAX_VALUE @see java.lang.Long#MIN_VALUE
Class Math, int round(float)

Returns the closest int to the argument. The result is rounded to an integer by adding 1/2 taking the floor of the result and casting the result to type int. In other words the result is equal to the value of the expression:

(int)Math.floor(a + 0.5f)

Special cases:

@param a a floatfloating-point value to be rounded to an integer. @return the value of the argument rounded to the nearest int value. @see java.lang.Integer#MAX_VALUE @see java.lang.Integer#MIN_VALUE
Class Math, double sin(double)

Returns the trigonometric sine of an angle. Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic. @param a an angle in radians. @return the sine of the argument.

Class Math, double sqrt(double)

Returns the correctly rounded positive square root of a double value. Special cases: Otherwise the result is the double value closest to the true mathetmatical square root of the argument value. @param a a double value. <--@return the value of √ a.--> @return the positive square root of a. If the argument is NaN or less than zero the result is NaN.
Class Math, double tan(double)

Returns the trigonometric tangent of an angle. Special cases:

A result must be within 1 ulp of the correctly rounded result. Results must be semi-monotonic. @param a an angle in radians. @return the tangent of the argument.

Class Math, double toDegrees(double)

Converts an angle measured in radians to thean approximately equivalent angle measured in degrees. The conversion from radians to degrees is generally inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0. @param angrad an angle in radians @return the measurement of the angle angrad in degrees. @since 1.2
Class Math, double toRadians(double)

Converts an angle measured in degrees to thean approximately equivalent angle measured in radians. The conversion from degrees to radians is generally inexact. @param angdeg an angle in degrees @return the measurement of the angle angdeg in radians. @since 1.2
Class Math, double E

The double value that is closer than any other to e the base of the natural logarithms.

Class NegativeArraySizeException

Thrown if an application tries to create an array with negative size. @author unascribed @version 1.16 0217 12/0203/0001 @since JDK1.0

Class NoClassDefFoundError

Thrown if the Java Virtual Machine or a classloaderClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

The searched-for class definition existed when the currently executing class was compiled but the definition can no longer be found. @author unascribed @version 1.17 0220 12/0203/0001 @since JDK1.0


Class NoSuchFieldError

Thrown if an application tries to access or modify a specified field of an object and that object no longer has that field.

Normally this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed. @author unascribed @version 1.9 0210 12/0203/0001 @since JDK1.0


Class NoSuchFieldException

Signals that the class doesn't have a field of a specified name. @author unascribed @version 1.11 0212 12/0203/0001 @since JDK1.1

Class NoSuchMethodError

Thrown if an application tries to call a specified method of a class (either static or instance) and that class no longer has a definition of that method.

Normally this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed. @author unascribed @version 1.18 0219 12/0203/0001 @since JDK1.0


Class NoSuchMethodException

Thrown when a particular method cannot be found. @author unascribed @version 1.10 0211 12/0203/0001 @since JDK1.0

Class NullPointerException

Thrown when an application attempts to use null in a case where an object is required. These include:

Applications should throw instances of this class to indicate other illegal uses of the null object. @author unascribed @version 1.16 0217 12/0203/0001 @since JDK1.0


Class Number

The abstract class Number is the superclass of classes BigDecimal BigInteger Byte Double Float Integer Long and Short.

Subclasses of Number must provide methods to convert the represented numeric value to byte double float int long and short. @author Lee Boynton @author Arthur van Hoff @version 1.25 0227 12/0203/0001 @see java.lang.Byte @see java.lang.Double @see java.lang.Float @see java.lang.Integer @see java.lang.Long @see java.lang.Short @since JDK1.0

Class Number, int intValue()

Returns the value of the specified number as an int. This may involve rounding or truncation. @return the numeric value represented by this object after conversion to type int.
Class Number, long longValue()

Returns the value of the specified number as a long. This may involve rounding or truncation. @return the numeric value represented by this object after conversion to type long.

Class NumberFormatException

Thrown to indicate that the application has attempted to convert a string to one of the numeric types but that the string does not have the appropriate format. @author unascribed @version 1.16 0217 12/0203/0001 @see java.lang.Integer#toString() @since JDK1.0

Class Object

Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects including arrays implement the methods of this class. @author unascribed @version 1.54 0258 12/0203/0001 @see java.lang.Class @since JDK1.0
Class Object, Object clone()

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that for any object x the expression:
 x.clone() = x
will be true and that the expression:
 x.clone().getClass() == x.getClass()
will be true but these are not absolute requirements. While it is typically the case that:
 x.clone().equals(x)
will be true this is not an absolute requirement. Copying

anBy convention the returned object willshould typicallybe obtained by calling entailsuper.clone. creatingIf a newclass instanceand all of its classsuperclasses but(except Object) obey this convention it alsowill be the case that x.clone().getClass() == x.getClass().

By convention the object returned by this method should be independent of this object (which is being cloned). To achieve this independence it may requirebe copyingnecessary to modify one or more fields of the object returned by super.clone before returning it. Typically this means copying any mutable objects that comprise the internal data"deep structure" structuresof asthe object being cloned and replacing the wellreferences to these objects with references to the copies. NoIf a constructorsclass arecontains only primitive fields or references to immutable objects then it is usually the case that no fields calledin the object returned by super.clone need to be modified.

The method clone for class Object performs a specific cloning operation. First if the class of this object does not implement the interface Cloneable then a CloneNotSupportedException is thrown. Note that all arrays are considered to implement the interface Cloneable. Otherwise this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object as if by assignment; the contents of the fields are not themselves cloned. Thus this method performs a "shallow copy" of this object not a "deep copy" operation.

The class Object does not itself implement the interface Cloneable so calling the clone method on an object whose class is Object will result in throwing an exception at run time. The clone method is implemented by the class Object as a convenient general utility for subclasses that implement the interface Cloneable possibly also overriding the clone method in which case the overriding definition can refer to this utility definition by the call: super.clone() @return a clone of this instance. @exception CloneNotSupportedException if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned. @exception OutOfMemoryError if there is not enough memory. @see java.lang.Cloneable

Class Object, boolean equals(Object)

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is for any reference values x and y this method returns true if and only if x and y refer to the same object (x==y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden so as to maintain the general contract for the hashCode method which states that equal objects must have equal hash codes. @param obj the reference object with which to compare. @return true if this object is the same as the obj argument; false otherwise. @see java.lang.Boolean#hashCode() @see java.util.Hashtable

Class Object, void wait()

Causes current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object. In other word'swords this method behaves exactly as if it simply performs the call wait(0).

The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method. The thread then waits until it can re-obtain ownership of the monitor and resumes execution.

This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor. @exception IllegalMonitorStateException if the current thread is not the owner of the object's monitor. @exception InterruptedException if another thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown. @see java.lang.Object#notify() @see java.lang.Object#notifyAll()


Class OutOfMemoryError

Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory and no more memory could be made available by the garbage collector. @author unascribed @version 1.18 0219 12/0203/0001 @since JDK1.0

Class Package

Package objects contain version information about the implementation and specification of a Java package. This versioning information is retrieved and made available by the classloaderClassLoader instance that loaded the class(es). Typically it is stored in the manifest that is distributed with the classes.

The set of classes that make up the package may implement a particular specification and if so the specification title version number and vendor strings identify that specification. An application can ask if the package is compatible with a particular version see the isCompatibleWith method for details.

Specification version numbers use a "Dewey Decimal" syntax that consists of positive decimal integers separated by periods "." for example "2.0" or "1.2.3.4.5.6.7". This allows an extensible number to be used to represent major minor micro etc versions. The version number must begin with a number.

The implementation title version and vendor strings identify an implementation and are made available conveniently to enable accurate reporting of the packages involved when a problem occurs. The contents all three implementation strings are vendor specific. The implementation version strings have no specified syntax and should only be compared for equality with desired version identifers. Within each classloaderClassLoader instance all classes from the same java package have the same Package object. The static methods allow a package to be found by name or the set of all packages known to the current class loader to be found.

@see ClassLoader#definePackage

Class Package, Package getPackage(String)

Find a package by name in the callers classloaderClassLoader instance. The callers classloaderClassLoader instance is used to find the package instance corresponding to the named class. If the callers classloaderClassLoader instance is null then the set of packages loaded by the system classloaderClassLoader instance is searched to find the named package.

Packages have attributes for versions and specifications only if the class loader created the package instance with the appropriate attributes. Typically those attributes are defined in the manifests that accompany the classes. @param name a package name for example java.lang. @return the package of the requested name. It may be null if no package information is available from the archive or codebase.

Class Package, Package[] getPackages()

Get all the packages currently known for the caller's classClassLoader loaderinstance. Those packages correspond to classes loaded via or accessible by name to that classClassLoader loaderinstance. If the caller's classClassLoader loaderinstance is the bootstrap classloaderClassLoader instance which may be represented by null in some implementations only packages corresponding to classes loaded by the bootstrap classClassLoader loaderinstance will be returned. @return a new array of packages known to the callers classloaderClassLoader instance. An zero length array is returned if none are known.
Class Package, int hashCode()

Return the hashcodehash code computed from the package name. @return the hodecodehode code computed from the package name.

Class Process

The Runtime.exec methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it. The class Process provides methods for performing input from the process performing output to the process waiting for the process to complete checking the exit status of the process and destroying (killing) the process.

The Runtime.exec methods may not work well for special processes on certain native platforms such as native windowing processes daemon processes Win16/DOS processes on Win32 or shell scripts. The created subprocess does not have its own terminal or console. All its standard io (i.e. stdin stdout stderr) operations will be redirected to the parent process through three streams (Process.getOutputStream() Process.getInputStream() Process.getErrorStream()). The parent process uses these streams to feed input to and get output from the subprocess. Because some native platforms only provide limited buffer size for standard input and output streams failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block and even deadlock.

The subprocess is not killed when there are no more references to the Process object but rather the subprocess continues executing asynchronously.

There is no requirement that a process represented by a Process object execute asynchronously or concurrently with respect to the Java process that owns the Process object. @author unascribed @version 1.17 0218 12/0203/0001 @see java.lang.Runtime#exec(java.lang.String) @see java.lang.Runtime#exec(java.lang.String java.lang.String[]) @see java.lang.Runtime#exec(java.lang.String[]) @see java.lang.Runtime#exec(java.lang.String[] java.lang.String[]) @since JDK1.0


Class Runnable

The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread. The class must define a method of no arguments called run.

This interface is designed to provide a common protocol for objects that wish to execute code while they are active. For example Runnable is implemented by class Thread. Being active simply means that a thread has been started and has not yet been stopped.

In addition Runnable provides the means for a class to be active while not subclassing Thread. A class that implements Runnable can run without subclassing Thread by instantiating a Thread instance and passing itself in as the target. In most cases the Runnable interface should be used if you are only planning to override the run() method and no other Thread methods. This is important because classes should not be subclassed unless the programmer intends on modifying or enhancing the fundamental behavior of the class. @author Arthur van Hoff @version 1.21 0222 12/0203/0001 @see java.lang.Thread @since JDK1.0


Class Runtime

Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running. The current runtime can be obtained from the getRuntime method.

An application cannot create its own instance of this class. @author unascribed @version 1.57 0462 12/0603/0001 @see java.lang.Runtime#getRuntime() @since JDK1.0

Class Runtime, Process exec(String, String[], File)

Executes the specified string command in a separate process with the specified environment and working directory.

This method breaks the command string into tokens and creates a new array cmdarray containing the tokens in the order that they were produced by the string tokenizer; it then performs the call exec(cmdarray envp). The token parsing is done by a java.util.StringTokenizer created by the call:

 new StringTokenizer(command) 
with no further modification of the character categories.

The environment variable settings are specified by envp. If envp is null the subprocess inherits the environment settings of the current process.

The working directory of the new subprocess is specified by dir. If dir is null the subprocess inherits the current working directory of the current process. @param command a specified system command. @param envp array of strings each element of which has environment variable settings in format name=value. @param dir the working directory of the subprocess or null if the subprocess should inherit the working directory of the current process. @return a Process object for managing the subprocess. @exception SecurityException if a security manager exists and its checkExec method doesn't allow creation of a subprocess. @exception IOException if an I/O error occurs @see java.lang.Runtime#exec(java.lang.String[] java.lang.String[] File) @see java.lang.SecurityManager#checkExec(java.lang.String) @since 1.3

Class Runtime, Process exec(String[], String[], File)

Executes the specified command and arguments in a separate process with the specified environment and working directory.

If there is a security manager its checkExec method is called with the first component of the array cmdarray as its argument. This may result in a security exception.

Given an array of strings cmdarray representing the tokens of a command line and an array of strings envp representing "environment" variable settings this method creates a new process in which to execute the specified command.

If envp is null the subprocess inherits the environment settings of the current process.

The working directory of the new subprocess is specified by dir. If dir is null the subprocess inherits the current working directory of the current process. @param cmdarray array containing the command to call and its arguments. @param envp array of strings each element of which has environment variable settings in format name=value. @param dir the working directory of the subprocess or null if the subprocess should inherit the working directory of the current process. @return a Process object for managing the subprocess. @exception SecurityException if a security manager exists and its checkExec method doesn't allow creation of a subprocess. @exception NullPointerException if cmdarray is null. @exception IndexOutOfBoundsException if cmdarray is an empty array (has length 0). @exception IOException if an I/O error occurs. @see java.lang.Process @see java.lang.SecurityException @see java.lang.SecurityManager#checkExec(java.lang.String) @since 1.3

Class Runtime, long freeMemory()

Returns the amount of free memory in the systemJava Virtual Machine. Calling the gc method may result in increasing the value returned by freeMemory. @return an approximation to the total amount of memory currently available for future allocated objects measured in bytes.
Class Runtime, void gc()

Runs the garbage collector. Calling this method suggests that the Java Virtual Machinevirtual machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. When control returns from the method call the Java Virtualvirtual Machinemachine has made its best effort to recycle all discarded objects.

The name gc stands for "garbage collector". The Java Virtualvirtual Machinemachine performs this recycling process automatically as needed in a separate thread even if the gc method is not invoked explicitly.

The method System#gc() is htethe conventional and convenient means of invoking this method.

Class Runtime, InputStream getLocalizedInputStream(InputStream)

Creates a localized version of an input stream. This method takes an InputStream and returns an InputStream equivalent to the argument in all respects except that it is localized: as characters in the local character set are read from the stream they are automatically converted from the local character set to Unicode.

If the argument is already a localized stream it may be returned as the result. @param in InputStream to localize @return a localized input stream @see java.io.InputStream @see java.io.BufferedReader#BufferedReader(java.io.Reader) @see java.io.InputStreamReader#InputStreamReader(java.io.InputStream) @deprecated As of JDK 1.1 the preferred way to translate a byte stream in the local encoding into a character stream in Unicode is via the InputStreamReader and BufferedReader classes.

Class Runtime, void load(String)

Loads the specified filename as a dynamic library. The filename argument must be a complete pathnamepath name. From java_g it will automagically insert "_g" before the ".so" (for example Runtime.getRuntime().load("/home/avh/lib/libX11.so");).

First if there is a security manager its checkLink method is called with the filename as its argument. This may result in a security exception.

This is similar to the method #loadLibrary(String) but it accepts a general file name as an argument rathanrather than just a library name allowing any file of native code to be loaded.

The method System#load(String) is the conventional and convenient means of invoking this method. @param filename the file to load. @exception SecurityException if a security manager exists and its checkLink method doesn't allow loading of the specified dynamic library @exception UnsatisfiedLinkError if the file does not exist. @see java.lang.Runtime#getRuntime() @see java.lang.SecurityException @see java.lang.SecurityManager#checkLink(java.lang.String)

Class Runtime, void runFinalization()

Runs the finalization methods of any objects pending finalization. Calling this method suggests that the Java Virtual Machinevirtual machine expend effort toward running the finalize methods of objects that have been found to be discarded but whose finalize methods have not yet been run. When control returns from the method call the Java Virtualvirtual Machinemachine has made a best effort to complete all outstanding finalizations.

The Java Virtualvirtual Machinemachine performs the finalization process automatically as needed in a separate thread if the runFinalization method is not invoked explicitly.

The method System#runFinalization() is the conventional and convenient means of invoking this method. @see java.lang.Object#finalize()

Class Runtime, long totalMemory()

Returns the total amount of memory in the Java Virtual Machinevirtual machine. The value returned by this method may vary over time depending on the host environment.

Note that the amount of memory required to hold an object of any given type may be implementation-dependent. @return the total amount of memory currently available for current and future objects measured in bytes.

Class Runtime, void traceInstructions(boolean)

Enables/Disables tracing of instructions. If the boolean argument is true this method suggests that the Java Virtual Machinevirtual machine emit debugging information for each instruction in the Java Virtualvirtual Machinemachine as it is executed. The format of this information and the file or other output stream to which it is emitted depends on the host environment. The virtual machine may ignore this request if it does not support this feature. The destination of the trace output is system dependent.

If the boolean argument is false this method causes the Java Virtualvirtual Machinemachine to stop performing the detailed instruction trace it is performing. @param on true to enable instruction tracing; false to disable this feature.

Class Runtime, void traceMethodCalls(boolean)

Enables/Disables tracing of method calls. If the boolean argument is true this method suggests that the Java Virtual Machinevirtual machine emit debugging information for each method in the Java Virtualvirtual Machinemachine as it is called. The format of this information and the file or other output stream to which it is emitted depends on the host environment. The virtual machine may ignore this request if it does not support this feature.

Calling this method with argument false suggests that the Java Virtualvirtual Machinemachine cease emitting per-call debugging information. @param on true to enable instruction tracing; false to disable this feature.


Class RuntimeException

RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine.

A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught. @author Frank Yellin @version 1.9 0211 12/0203/0001 @since JDK1.0

Class RuntimeException, constructor RuntimeException()

Constructs a new runtime exception with RuntimeExceptionnull withas noits detail message. The cause is not initialized and may subsequently be initialized by a call to #initCause
Class RuntimeException, constructor RuntimeException(String)

Constructs a RuntimeExceptionnew runtime exception with the specified detail message. The cause is not initialized and may subsequently be initialized by a call to #initCause @param smessage the detail message. The detail message is saved for later retrieval by the #getMessage() method.

Class RuntimePermission

This class is for runtime permissions. A RuntimePermission contains a name (also referred to as a "target name") but no actions list; you either have the named permission or you don't.

The target name is the name of the runtime permission (see below). The naming convention follows the hierarchical property naming convention. Also an asterisk may appear at the end of the name following a "." or by itself to signify a wildcard match. For example: "loadLibrary.*" or "*" is valid "*loadLibrary" or "a*b" is not valid.

The following table lists all the possible RuntimePermission target names and for each provides a description of what the permission allows and a discussion of the risks of granting code the permission.

Permission Target Name What the Permission Allows Risks of Allowing this Permission
createClassLoader Creation of a class loader This is an extremely dangerous permission to grant. Malicious applications that can instantiate their own class loaders could then load their own rogue classes into the system. These newly loaded classes could be placed into any protection domain by the class loader thereby automatically granting the classes the permissions for that domain.
getClassLoader Retrieval of a class loader (e.g. the class loader for the calling class) This would grant an attacker permission to get the class loader for a particular class. This is dangerous because having access to a class's class loader allows the attacker to load other classes available to that class loader. The attacker would typically otherwise not have access to those classes.
setContextClassLoader Setting of the context class loader used by a thread The context class loader is used by system code and extensions when they need to lookup resources that might not exist in the system class loader. Granting setContextClassLoader permission would allow code to change which context class loader is used for a particular thread including system threads.
setSecurityManager Setting of the security manager (possibly replacing an existing one) The security manager is a class that allows applications to implement a security policy. Granting the setSecurityManager permission would allow code to change which security manager is used by installing a different possibly less restrictive security manager thereby bypassing checks that would have been enforced by the original security manager.
createSecurityManager Creation of a new security manager This gives code access to protected sensitive methods that may disclose information about other classes or the execution stack.
exitVM Halting of the Java Virtual Machine This allows an attacker to mount a denial-of-service attack by automatically forcing the virtual machine to halt. Note: The "exitVM" permission is automatically granted to all code loaded from the application class path thus enabling applications to terminate themselves.
shutdownHooks Registration and cancellation of virtual-machine shutdown hooks This allows an attacker to register a malicious shutdown hook that interferes with the clean shutdown of the virtual machine.
setFactory Setting of the socket factory used by ServerSocket or Socket or of the stream handler factory used by URL This allows code to set the actual implementation for the socket server socket stream handler or RMI socket factory. An attacker may set a faulty implementation which mangles the data stream.
setIO Setting of System.out System.in and System.err This allows changing the value of the standard system streams. An attacker may change System.in to monitor and steal user input or may set System.err to a "null" OutputSteam which would hide any error messages sent to System.err.
modifyThread Modification of threads e.g. via calls to Thread stop suspend resume setPriority and setName methods This allows an attacker to start or suspend any thread in the system.
stopThread Stopping of threads via calls to the Thread stop method This allows code to stop any thread in the system provided that it is already granted permission to access that thread. This poses as a threat because that code may corrupt the system by killing existing threads.
modifyThreadGroup modification of thread groups e.g. via calls to ThreadGroup destroy getParent resume setDaemon setMaxPriority stop and suspend methods This allows an attacker to create thread groups and set their run priority.
getProtectionDomain Retrieval of the ProtectionDomain for a class This allows code to obtain policy information for a particular code source. While obtaining policy information does not compromise the security of the system it does give attackers additional information such as local file names for example to better aim an attack.
readFileDescriptor Reading of file descriptors This would allow code to read the particular file associated with the file descriptor read. This is dangerous if the file contains confidential data.
writeFileDescriptor Writing to file descriptors This allows code to write to a particular file associated with the descriptor. This is dangerous because it may allow malicousmalicious code to plant viruses or at the very least fill up your entire disk.
loadLibrary.{library name} Dynamic linking of the specified library It is dangerous to allow an applet permission to load native code libraries because the Java security architecture is not designed to and does not prevent malicious behavior at the level of native code.
accessClassInPackage.{package name} Access to the specified package via a class loader's loadClass method when that class loader calls the SecurityManager checkPackageAcesss method This gives code access to classes in packages to which it normally does not have access. Malicious code may use these classes to help in its attempt to compromise security in the system.
defineClassInPackage.{package name} Definition of classes in the specified package via a class loader's defineClass method when that class loader calls the SecurityManager checkPackageDefinition method. This grants code permission to define a class in a particular package. This is dangerous because malicious code with this permission may define rogue classes in trusted packages like java.security or java.lang for example.
accessDeclaredMembers Access to the declared members of a class This grants code permission to query a class for its public protected default (package) access and private fields and/or methods. Although the code would have access to the private and protected field and method names it would not have access to the private/protected field data and would not be able to invoke any private methods. Nevertheless malicious code may use this information to better aim an attack. Additionally it may invoke any public methods and/or access public fields in the class. This could be dangerous if the code would normally not be able to invoke those methods and/or access the fields because it can't cast the object to the class/interface with those methods and fields.
queuePrintJob Initiation of a print job request This could print sensitive information to a printer or simply waste paper.
@see java.security.BasicPermission @see java.security.Permission @see java.security.Permissions @see java.security.PermissionCollection @see java.lang.SecurityManager @version 1.3740 0001/0212/0203 @author Marianne Mueller @author Roland Schemers


Class SecurityException

Thrown by the security manager to indicate a security violation. @author unascribed @version 1.11 0212 12/0203/0001 @see java.lang.SecurityManager @since JDK1.0

Class SecurityManager

The security manager is a class that allows applications to implement a security policy. It allows an application to determine before performing a possibly unsafe or sensitive operation what the operation is and whether it is being attempted in a security context that allows the operation to be performed. The application can allow or disallow the operation.

The SecurityManager class contains many methods with names that begin with the word check. These methods are called by various methods in the Java libraries before those methods perform certain potentially sensitive operations. The invocation of such a check method typically looks like this:

 SecurityManager security = System.getSecurityManager(); if (security = null) { security.checkXXX(argument  . . . ); } 

The security manager is thereby given an opportunity to prevent completion of the operation by throwing an exception. A security manager routine simply returns if the operation is permitted but throws a SecurityException if the operation is not permitted. The only exception to this convention is checkTopLevelWindow which returns a boolean value.

The current security manager is set by the setSecurityManager method in class System. The current security manager is obtained by the getSecurityManager method.

The special method SecurityManager#checkPermission(java.security.Permission) determines whether an access request indicated by a specified permission should be granted or denied. The default implementation calls

 AccessController.checkPermission(perm); 

If a requested access is allowed checkPermission returns quietly. If denied a SecurityException is thrown.

As of Java 2 SDK v1.2 the default implementation of each of the other check methods in SecurityManager is to call the SecurityManager checkPermission method to determine if the calling thread has permission to perform the requested operation.

Note that the checkPermission method with just a single permission argument always performs security checks within the context of the currently executing thread. Sometimes a security check that should be made within a given context will actually need to be done from within a different context (for example from within a worker thread). The getSecurityContext method and the java.lang.Object checkPermission} method that includes a context argument are provided for this situation. The getSecurityContext method returns a "snapshot" of the current calling context. (The default implementation returns an AccessControlContext object.) A sample call is the following:

 Object context = null; SecurityManager sm = System.getSecurityManager(); if (sm = null) context = sm.getSecurityContext(); 

The checkPermission method that takes a context object in addition to a permission makes access decisions based on that context rather than on that of the current execution thread. Code within a different context can thus call that method passing the permission and the previously-saved context object. A sample call using the SecurityManager sm obtained as in the previous example is the following:

 if (sm = null) sm.checkPermission(permission context); 

Permissions fall into these categories: File Socket Net Security Runtime Property AWT Reflect and Serializable. The classes managing these various permission categories are java.io.FilePermission java.net.SocketPermission java.net.NetPermission java.security.SecurityPermission java.lang.RuntimePermission java.util.PropertyPermission java.awt.AWTPermission java.lang.reflect.ReflectPermission and java.io.SerializablePermission.

All but the first two (FilePermission and SocketPermission) are subclasses of java.security.BasicPermission which itself is an abstract subclass of the top-level class for permissions which is java.security.Permission. BasicPermission defines the functionality needed for all permissions that contain a name that follows the hierarchical property naming convention (for example "exitVM" "setFactory" "queuePrintJob" etc). An asterisk may appear at the end of the name following a "." or by itself to signify a wildcard match. For example: "a.*" or "*" is valid "*a" or "a*b" is not valid.

FilePermission and SocketPermission are subclasses of the top-level class for permissions (java.security.Permission). Classes like these that have a more complicated name syntax than that used by BasicPermission subclass directly from Permission rather than from BasicPermission. For example for a java.io.FilePermission object the permission name is the pathnamepath name of a file (or directory).

Some of the permission classes have an "actions" list that tells the actions that are permitted for the object. For example for a java.io.FilePermission object the actions list (such as "read write") specifies which actions are granted for the specified file (or for files in the specified directory).

Other permission classes are for "named" permissions - ones that contain a name but no actions list; you either have the named permission or you don't.

Note: There is also a java.security.AllPermission permission that implies all permissions. It exists to simplify the work of system administrators who might need to perform multiple tasks that require all (or numerous) permissions.

See Permissions in the Java 2 SDK for permission-related information. This document includes for example a table listing the various SecurityManager check methods and the permission(s) the default implementation of each such method requires. It also contains a table of all the version 1.2 methods that require permissions and for each such method tells which permission it requires.

For more information about SecurityManager changes made in the Java 2 SDK and advice regarding porting of 1.1-style security managers see the security documentation. @author Arthur van Hoff @author Roland Schemers @version 1.121 02127 12/0203/0001 @see java.lang.ClassLoader @see java.lang.SecurityException @see java.lang.SecurityManager#checkTopLevelWindow(java.lang.Object) checkTopLevelWindow @see java.lang.System#getSecurityManager() getSecurityManager @see java.lang.System#setSecurityManager(java.lang.SecurityManager) setSecurityManager @see java.security.AccessController AccessController @see java.security.AccessControlContext AccessControlContext @see java.security.AccessControlException AccessControlException @see java.security.Permission @see java.security.BasicPermission @see java.io.FilePermission @see java.net.SocketPermission @see java.util.PropertyPermission @see java.lang.RuntimePermission @see java.awt.AWTPermission @see java.security.Policy Policy @see java.security.SecurityPermission SecurityPermission @see java.security.ProtectionDomain @since JDK1.0

Class SecurityManager, void checkMulticast(InetAddress, byte)

Throws a SecurityException if the calling thread is not allowed to use (join/leave/send/receive) IP multicast.

This method calls checkPermission with the java.net.SocketPermission(maddr.getHostAddress() "accept connect") permission.

If you override this method then you should make a call to super.checkMulticast at the point the overridden method would normally throw an exception. @param maddr Internet group address to be used. @param ttl value in use if it is multicast send. Note: this particular implementation does not use the ttl parameter. @exception SecurityException if the calling thread is not allowed to use (join/leave/send/receive) IP multicast. @exception NullPointerException if the address argument is null. @since JDK1.1 @deprecated Use #checkPermission(java.security.Permission) instead @see #checkPermission(java.security.Permission) checkPermission

Class SecurityManager, boolean checkTopLevelWindow(Object)

Returns false if the calling thread is not trusted to bring up the top-level window indicated by the window argument. In this case the caller can still decide to show the window but the window should include some sort of visual warning. If the method returns true then the window can be shown without any special restrictions.

See class Window for more information on trusted and untrusted windows.

This method calls checkPermission with the AWTPermission("showWindowWithoutWarningBanner") permission and returns true if a SecurityException is not thrown otherwise it returns false.

If you override this method then you should make a call to super.checkTopLevelWindow at the point the overridden method would normally return false and the value of super.checkTopLevelWindow should be returned. @param window the new window that is being created. @return true if the calling thread is trusted to put up top-level windows; false otherwise. @exception SecurityException if creation is disallowed entirely. @exception NullPointerException if the window argument is null. @see java.awt.Window @see #checkPermission(java.security.Permission) checkPermission


Class Short

The Short class wraps a value of primitive type short in an object. An object of type Short contains a single field whose type is theshort.

In addition standardthis wrapperclass provides several methods for converting a short to a String and a String to a short as well as other constants and valuesmethods useful when dealing with a short. @author Nakul Saraiya @version 1.22 0231 12/0203/0001 @see java.lang.Number @since JDK1.1

Class Short, constructor Short(String)

Constructs a newly allocated Short object initialized tothat represents the short value specifiedindicated by the String parameter. The radixstring is assumedconverted to bea short value in exactly the manner used by the parseShort method for radix 10. @param s the String to be converted to a Short @exception NumberFormatException If the String does not contain a parsable short. @see java.lang.Short#parseShort(java.lang.String int)
Class Short, constructor Short(short)

Constructs a newly allocated Short object initialized tothat represents the specified short value. @param value the initial value ofto be represented by the Short.
Class Short, byte byteValue()

Returns the value of this Short as a byte.
Class Short, int compareTo(Object)

Compares this Short object to another Objectobject. If the Objectobject is a Short this function behaves like compareTo(Short). Otherwise it throws a ClassCastException (as ShortsShort objects are comparable only comparable to other ShortsShort objects). @param o the Object to be compared. @return the value 0 if the argument is a Short numerically equal to this Short; a value less than 0 if the argument is a Short numerically greater than this Short; and a value greater than 0 if the argument is a Short numerically less than this Short. @exception ClassCastException if the argument is not a Short. @see java.lang.Comparable @since 1.2
Class Short, int compareTo(Short)

Compares two ShortsShort objects numerically. @param anotherShort the Short to be compared. @return the value 0 if the argumentthis Short is equal to thisthe argument Short; a value less than 0 if this Short is numerically less than the Short argument Short; and a value greater than 0 if this Short is numerically greater than the Short argument Short (signed comparison). @since 1.2
Class Short, Short decode(String)

Decodes a String into a Short. Accepts decimal hexadecimal and octal numbers ingiven by the following formatsgrammar: [-]
decimal
constant
DecodableString: [-]
Signopt DecimalNumeral
Signopt 0x hexHexDigits
Signopt constant0X [-]HexDigits
Signopt # HexDigits
Signopt hex0 constantOctalDigits

Sign: [
-] 0
octal
DecimalNumeral HexDigits and OctalDigits are defined in §3.10.1 of constantthe Java Language Specification.

The constantsequence of characters following an (optional) negative sign and/or "radix specifier" ("0x" "0X" "#" or leading zero) is parsed as by the Short.parseShort method with the specifiedindicated radix (10 816 or 168). This constantsequence of characters must berepresent a positive value or a NumberFormatException will resultbe thrown. The result is madenegated negative if first character of the specified String is the negativeminus sign. No whitespace characters are permitted in the String. @param nm the String to decode. @return thea Short represented byobject holding the specifiedshort string.value represented by nm @exception NumberFormatException if the String does not contain a parsable short. @see java.lang.Short#parseShort(java.lang.String int)

Class Short, double doubleValue()

Returns the value of this Short as a double.
Class Short, boolean equals(Object)

Compares this object to the specified object. The result is true if and only if the argument is not null and is a Short object that contains the same short value as this object. @param obj the object to compare with @return true if the objects are the same; false otherwise.
Class Short, float floatValue()

Returns the value of this Short as a float.
Class Short, int hashCode()

Returns a hashcodehash code for this Short.
Class Short, int intValue()

Returns the value of this Short as an int.
Class Short, long longValue()

Returns the value of this Short as a long.
Class Short, short parseShort(String)

AssumingParses the specifiedstring String representsargument as a signed decimal short. returns thatThe characters short'sin value.the Throws an exceptionstring must all ifbe decimal digits except that the String cannotfirst character may be parsedan asASCII minus sign '-' ('\u002D') to indicate a shortnegative value. The radixresulting short value is assumed toreturned exactly beas if the argument and the radix 10 were given as arguments to the int) method. @param s thea String containing the short representation to be parsed @return short the short value represented by the specifiedargument stringin decimal. @exception NumberFormatException If the string does not contain a parsable short.
Class Short, short parseShort(String, int)

AssumingParses the specifiedstring String representsargument as a signed short in the radix specified by the second argument. The characters in the string must all be digits of the specified radix (as determined by whether int) returns a nonnegative value) except that shortthe first character may be an ASCII minus sign 's-' ('\u002D') to indicate a negative value. ThrowsThe anresulting byte value is returned.

An exception of type NumberFormatException is thrown if any of the Stringfollowing situations occurs:

  • The first argument is null or is a string cannotof length zero.
  • The radix is either smaller than java.lang.Character#MIN_RADIX or larger than java.lang.Character#MAX_RADIX
  • Any character of the string is not a digit of the specified radix except that the first character may be parseda asminus sign '-' ('\u002D') provided that the string is longer than length 1.
  • The value represented by the string is not a value of type short.
@param s the String containing the short representation to be parsed @param radix the radix to be used while parsing s @return Thethe short value represented by the specified string argument in the specified radix. @exception NumberFormatException If the String does not contain a parsable short.
Class Short, short shortValue()

Returns the value of this Short as a short.
Class Short, String toString()

Returns a String object representing this Short's value. The value is converted to signed decimal representation and returned as a string exactly as if the short value were given as an argument to the java.lang.Short#toString(short) method. @return a string representation of the value of this object in base 10.
Class Short, String toString(short)

Returns a new String object representing the specified Shortshort. The radix is assumed to be 10. @param s the short to be converted @return The String that representsthe string representation of the specified short in radix@see 10java.lang.Integer#toString(int)
Class Short, Short valueOf(String)

AssumingReturns a Short object holding the value given by the specified String. representsThe argument is interpreted as representing a signed decimal short returns a new Shortexactly as if the objectargument were initializedgiven to thatthe value#parseShort(java.lang.String) Throwsmethod. an exception ifThe result is a Short object that represents the Stringshort value cannot be parsedspecified by the asstring.

In other words this method returns a shortByte object equal to the value of:

new Short(Short.parseShort(s))
@param s the String containing the integerstring to be parsed @return a Short ofobject holding the value represented by the specified string in radix 10.argument @exception NumberFormatException If the String does not contain a parsable short.
Class Short, Short valueOf(String, int)

AssumingReturns a Short object holding the value extracted from the specified String representswhen parsed with the radix given by the second argument. The first argument is interpreted as representing a signed short returns a new Shortin the radix specified objectby the second argument exactly initializedas if the argument were given to thatthe valueint) method. ThrowsThe result an exceptionis a ifShort object that represents the Stringshort cannot be parsedvalue specified by asthe string.

In other words this method returns a shortShort object equal to the value of:

new Short(Short.parseShort(s radix))
@param s the String containing the integerstring to be parsed @param radix the radix to be used in interpreting s @return Thea Short object holding the value represented by the specified string argument in the specified radix. @exception NumberFormatException If the String does not contain a parsable short.
Class Short, short MAX_VALUE

TheA constant holding the maximum value a Shortshort can have 215-1.
Class Short, short MIN_VALUE

TheA constant holding the minimum value a Shortshort can have -215.
Class Short, Class TYPE

The Class objectinstance representing the primitive type short.

Class StackOverflowError

Thrown when a stack overflow occurs because an application recurses too deeply. @author unascribed @version 1.18 0219 12/0203/0001 @since JDK1.0

Class StrictMath

The class StrictMath contains methods for performing basic numeric operations such as the elementary exponential logarithm square root and trigonometric functions.

To help ensure portability of Java programs the definitions of many of the numeric functions in this package require that they produce the same results as certain published algorithms. These algorithms are available from the well-known network library netlib as the package "Freely Distributable Math Library" (fdlibm). These algorithms which are written in the C programming language are then to be understood as executed with all floating-point operations following the rules of Java floating-point arithmetic.

The network library may be found on the World Wide Web at:

 http://metalab.unc.edu/ 

The Java math library is defined with respect to the version of fdlibm dated January 4 1995. Where fdlibm provides more than one definition for a function (such as acos) use the "IEEE 754 core function" version (residing in a file whose name begins with the letter e). @author unascribed @version 1.9 0213 12/0203/0001 @since 1.3

Class StrictMath, double abs(double)

Returns the absolute value of a double value. If the argument is not negative the argument is returned. If the argument is negative the negation of the argument is returned. Special cases: In other words the result is equalthe tosame as the value of the expression:

Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1) @param a athe doubleargument whose absolute value. is to be determined @return the absolute value of the argument.

Class StrictMath, float abs(float)

Returns the absolute value of a float value. If the argument is not negative the argument is returned. If the argument is negative the negation of the argument is returned. Special cases: In other words the result is equalthe tosame as the value of the expression:

Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))
@param a athe floatargument whose absolute value. is to be determined @return the absolute value of the argument.
Class StrictMath, int abs(int)

Returns the absolute value of an int value.. If the argument is not negative the argument is returned. If the argument is negative the negation of the argument is returned.

Note that if the argument is equal to the value of Integer.MIN_VALUE the most negative representable int value the result is that same value which is negative. @param a the int argument whose absolute value is to be determined. @return the absolute value of the argument. @see java.lang.Integer#MIN_VALUE

Class StrictMath, long abs(long)

Returns the absolute value of a long value. If the argument is not negative the argument is returned. If the argument is negative the negation of the argument is returned.

Note that if the argument is equal to the value of Long.MIN_VALUE the most negative representable long value the result is that same value which is negative. @param a athe longargument whose absolute value is to be determined. @return the absolute value of the argument. @see java.lang.Long#MIN_VALUE

Class StrictMath, double acos(double)

Returns the arc cosine of an angle in the range of 0.0 through pi. Special case: @param a the double value whose arc cosine is to be returned. @return the arc cosine of the argument.
Class StrictMath, double asin(double)

Returns the arc sine of an angle in the range of -pi/2 through pi/2. Special cases: @param a the double value whose arc sine is to be returned. @return the arc sine of the argument.
Class StrictMath, double atan(double)

Returns the arc tangent of an angle in the range of -pi/2 through pi/2. Special cases: @param a the double value whose arc tangent is to be returned. @return the arc tangent of the argument.
Class StrictMath, double atan2(double, double)

Converts rectangular coordinates (bx  ay) to polar (r  theta). This method computes the phase theta by computing an arc tangent of ay/bx in the range of -pi to pi. Special cases: @param a ay the doubleordinate value.coordinate @param b ax the doubleabscissa value.coordinate @return the theta component of the point (r  theta) in polar coordinates that corresponds to the point (bx  ay) in Cartesian coordinates.
Class StrictMath, double ceil(double)

Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer. Special cases: Note that the value of Math.ceil(x) is exactly the value of -Math.floor(-x). @param a a double value. <--@return the value ⌈ a ⌉.--> @return the smallest (closest to negative infinity) doublefloating-point value that is not less than the argument and is equal to a mathematical integer.
Class StrictMath, double cos(double)

Returns the trigonometric cosine of an angle. Special casecases: @param a an angle in radians. @return the cosine of the argument.
Class StrictMath, double exp(double)

Returns the exponentialEuler's number e (i.e. 2.718...) raised to the power of a double value. Special cases: @param a athe doubleexponent valueto raise e to. @return the value ea where e is the base of the natural logarithms.
Class StrictMath, double floor(double)

Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer. Special cases: @param a a double value. <--@return the value ⌊ a ⌋.--> @return the largest (closest to positive infinity) doublefloating-point value that is not greater than the argument and is equal to a mathematical integer.
Class StrictMath, double max(double, double)

Returns the greater of two double values. That is the result is the argument closer to positive infinity. If the arguments have the same value the result is that same value. If either value is NaN then the result is NaN. Unlike the the numerical comparison operators this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other negative zero the result is positive zero. @param a a doublean valueargument. @param b a doubleanother valueargument. @return the larger of a and b.
Class StrictMath, float max(float, float)

Returns the greater of two float values. That is the result is the argument closer to positive infinity. If the arguments have the same value the result is that same value. If either value is NaN then the result is NaN. Unlike the the numerical comparison operators this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other negative zero the result is positive zero. @param a a floatan valueargument. @param b a floatanother valueargument. @return the larger of a and b.
Class StrictMath, int max(int, int)

Returns the greater of two int values. That is the result is the argument closer to the value of Integer.MAX_VALUE. If the arguments have the same value the result is that same value. @param a an int valueargument. @param b an intanother valueargument. @return the larger of a and b. @see java.lang.Long#MAX_VALUE
Class StrictMath, long max(long, long)

Returns the greater of two long values. That is the result is the argument closer to the value of Long.MAX_VALUE. If the argumens have the same value the result is that same value. @param a a longan valueargument. @param b a longanother valueargument. @return the larger of a and b. @see java.lang.Long#MAX_VALUE
Class StrictMath, double min(double, double)

Returns the smaller of two double values. That is the result is the value closer to negative infinity. If the arguments have the same value the result is that same value. If either value is NaN then the result is NaN. Unlike the the numerical comparison operators this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other is negative zero the result is negative zero. @param a a doublean valueargument. @param b a doubleanother valueargument. @return the smaller of a and b.
Class StrictMath, float min(float, float)

Returns the smaller of two float values. That is the result is the value closer to negative infinity. If the arguments have the same value the result is that same value. If either value is NaN then the result is NaN. Unlike the the numerical comparison operators this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other is negative zero the result is negative zero. @param a a floatan valueargument. @param b a floatanother valueargument. @return the smaller of a and b.
Class StrictMath, int min(int, int)

Returns the smaller of two int values. That is the result the argument closer to the value of Integer.MIN_VALUE. If the arguments have the same value the result is that same value. @param a an int valueargument. @param b an intanother valueargument. @return the smaller of a and b. @see java.lang.Long#MIN_VALUE
Class StrictMath, long min(long, long)

Returns the smaller of two long values. That is the result is the argument closer to the value of Long.MIN_VALUE. If the arguments have the same value the result is that same value. @param a a longan valueargument. @param b a longanother valueargument. @return the smaller of a and b. @see java.lang.Long#MIN_VALUE
Class StrictMath, double pow(double, double)

Returns of value of the first argument raised to the power of the second argument. Special cases:

(In the foregoing descriptions a floating-point value is considered to be an integer if and only if it is a fixed point of the method ceil or whichequivalently is the same thing a fixed point of the method floor A value is a fixed point of a one-argument method if and only if the result of applying the method to the value is equal to the value.) @param a a double valuebase. @param b a doublethe valueexponent. @return the value ab.

Class StrictMath, double rint(double)

Returns the double value that is closest in value to athe argument and is equal to a mathematical integer. If two double values that are mathematical integers are equally close to the value of the argument the result is the integer value that is even. Special cases: @param a a double value. @return the closest doublefloating-point value to a that is equal to a mathematical integer.
Class StrictMath, long round(double)

Returns the closest long to the argument. The result is rounded to an integer by adding 1/2 taking the floor of the result and casting the result to type long. In other words the result is equal to the value of the expression:

(long)Math.floor(a + 0.5d)

Special cases:

@param a a doublefloating-point value to be rounded to a long. @return the value of the argument rounded to the nearest long value. @see java.lang.Long#MAX_VALUE @see java.lang.Long#MIN_VALUE
Class StrictMath, int round(float)

Returns the closest int to the argument. The result is rounded to an integer by adding 1/2 taking the floor of the result and casting the result to type int. In other words the result is equal to the value of the expression:

(int)Math.floor(a + 0.5f)

Special cases:

@param a a floatfloating-point value to be rounded to an integer. @return the value of the argument rounded to the nearest int value. @see java.lang.Integer#MAX_VALUE @see java.lang.Integer#MIN_VALUE
Class StrictMath, double sin(double)

Returns the trigonometric sine of an angle. Special cases: @param a an angle in radians. @return the sine of the argument.
Class StrictMath, double sqrt(double)

Returns the correctly rounded positive square root of a double value. Special cases: Otherwise the result is the double value closest to the true mathetmatical square root of the argument value. @param a a double value. <--@return the value of √ a.--> @return the positive square root of a.
Class StrictMath, double tan(double)

Returns the trigonometric tangent of an angle. Special cases: @param a an angle in radians. @return the tangent of the argument.
Class StrictMath, double toDegrees(double)

Converts an angle measured in radians to thean approximately equivalent angle measured in degrees. The conversion from radians to degrees is generally inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0. @param angrad an angle in radians @return the measurement of the angle angrad in degrees.
Class StrictMath, double toRadians(double)

Converts an angle measured in degrees to thean approximately equivalent angle measured in radians. The conversion from degrees to radians is generally inexact. @param angdeg an angle in degrees @return the measurement of the angle angdeg in radians.
Class StrictMath, double E

The double value that is closer than any other to e the base of the natural logarithms.

Class String

The String class represents character strings. All string literals in Java programs such as "abc" are implemented as instances of this class.

Strings are constant; their values cannot be changed after they are created. String buffers support mutable strings. Because String objects are immutable they can be shared. For example:

 String str = "abc"; 

is equivalent to:

 char data[] = {'a' 'b' 'c'}; String str = new String(data); 

Here are some more examples of how strings can be used:

 System.out.println("abc"); String cde = "cde"; System.out.println("abc" + cde); String c = "abc".substring(2 3); String d = cde.substring(1 2); 

The class String includes methods for examining individual characters of the sequence for comparing strings for searching strings for extracting substrings and for creating a copy of a string with all characters translated to uppercase or to lowercase. Case mapping relies heavily on the information provided by the Unicode Consortium's Unicode 3.0 specification. The specification's UnicodeData.txt and SpecialCasing.txt files are used extensively to provide case mapping.

The Java language provides special support for the string concatentation operator ( + ) and for conversion of other objects to strings. String concatenation is implemented through the StringBuffer class and its append method. String conversions are implemented through the method toString defined by Object and inherited by all classes in Java. For additional information on string concatenation and conversion see Gosling Joy and Steele The Java Language Specification. @author Lee Boynton @author Arthur van Hoff @version 1.130 02150 01/0912/0103 @see java.lang.Object#toString() @see java.lang.StringBuffer @see java.lang.StringBuffer#append(boolean) @see java.lang.StringBuffer#append(char) @see java.lang.StringBuffer#append(char[]) @see java.lang.StringBuffer#append(char[] int int) @see java.lang.StringBuffer#append(double) @see java.lang.StringBuffer#append(float) @see java.lang.StringBuffer#append(int) @see java.lang.StringBuffer#append(long) @see java.lang.StringBuffer#append(java.lang.Object) @see java.lang.StringBuffer#append(java.lang.String) @see Character encodingsjava.nio.charset.Charset @since JDK1.0

Class String, constructor String(String)

Initializes a newly created String object so that it represents the same sequence of characters as the argument; in other words the newly created string is a copy of the argument string. @param valueoriginal a String.
Class String, constructor String(byte[])

ConstructConstructs a new String by convertingdecoding the specified array of bytes using the platform's default character encodingcharset. The length of the new String is a function of the encodingcharset and hence may not be equal to the length of the byte array.

The behavior of this constructor when the given bytes are not valid in the default charset is unspecified. The java.nio.charset.CharsetDecoder class should be used when more control over the decoding process is required. @param bytes Thethe bytes to be converteddecoded into characters @since JDK1.1

Class String, constructor String(byte[], String)

ConstructConstructs a new String by convertingdecoding the specified array of bytes using the specified character encodingcharset. The length of the new String is a function of the encodingcharset and hence may not be equal to the length of the byte array.

The behavior of this constructor when the given bytes are not valid in the given charset is unspecified. The java.nio.charset.CharsetDecoder class should be used when more control over the decoding process is required. @param bytes Thethe bytes to be converteddecoded into characters @param enc ThecharsetName the name of a supported character encodingcharset @exception UnsupportedEncodingException If the named encodingcharset is not supported @exception NullPointerException If charsetName is null @since JDK1.1

Class String, constructor String(byte[], int)

Allocates a new String containing characters constructed from an array of 8-bit integer values. Each character cin the resulting string is constructed from the corresponding component b in the byte array such that:

 c == (char)(((hibyte & 0xff) << 8) | (b & 0xff)) 
@deprecated This method does not properly convert bytes into characters. As of JDK 1.1 the preferred way to do this is via the String constructors that take a character-encodingcharset name or that use the platform's default encodingcharset. @param ascii the bytes to be converted to characters. @param hibyte the top 8 bits of each 16-bit Unicode character. @exception NullPointerException If ascii is null. @see java.lang.String#String(byte[] int int java.lang.String) @see java.lang.String#String(byte[] int int) @see java.lang.String#String(byte[] java.lang.String) @see java.lang.String#String(byte[])
Class String, constructor String(byte[], int, int)

ConstructConstructs a new String by convertingdecoding the specified subarray of bytes using the platform's default character encodingcharset. The length of the new String is a function of the encodingcharset and hence may not be equal to the length of the subarray.

The behavior of this constructor when the given bytes are not valid in the default charset is unspecified. The java.nio.charset.CharsetDecoder class should be used when more control over the decoding process is required. @param bytes Thethe bytes to be converteddecoded into characters @param offset Indexthe index of the first byte to convertdecode @param length Numberthe number of bytes to convertdecode @since JDK1.1

Class String, constructor String(byte[], int, int, String)

ConstructConstructs a new String by convertingdecoding the specified subarray of bytes using the specified character encodingcharset. The length of the new String is a function of the encodingcharset and hence may not be equal to the length of the subarray.

The behavior of this constructor when the given bytes are not valid in the given charset is unspecified. The java.nio.charset.CharsetDecoder class should be used when more control over the decoding process is required. @param bytes Thethe bytes to be converteddecoded into characters @param offset Indexthe index of the first byte to convertdecode @param length Numberthe number of bytes to convertdecode @param enccharsetName Thethe name of a supported character encodingcharset @throws UnsupportedEncodingException if the named encodingcharset is not supported @throws IndexOutOfBoundsException if the offset and countlength arguments index characters outside the bounds of the value array. @throws NullPointerException if charsetName is null @since JDK1.1

Class String, constructor String(byte[], int, int, int)

Allocates a new String constructed from a subarray of an array of 8-bit integer values.

The offset argument is the index of the first byte of the subarray and the count argument specifies the length of the subarray.

Each byte in the subarray is converted to a char as specified in the method above. @deprecated This method does not properly convert bytes into characters. As of JDK 1.1 the preferred way to do this is via the String constructors that take a character-encodingcharset name or that use the platform's default encodingcharset. @param ascii the bytes to be converted to characters. @param hibyte the top 8 bits of each 16-bit Unicode character. @param offset the initial offset. @param count the length. @exception IndexOutOfBoundsException if the offset or count argument is invalid. @exception NullPointerException if ascii is null. @see java.lang.String#String(byte[] int) @see java.lang.String#String(byte[] int int java.lang.String) @see java.lang.String#String(byte[] int int) @see java.lang.String#String(byte[] java.lang.String) @see java.lang.String#String(byte[])

Class String, int compareTo(String)

Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this String object is compared lexicographically to the character sequence represented by the argument string. The result is a negative integer if this String object lexicographically precedes the argument string. The result is a positive integer if this String object lexicographically follows the argument string. The result is zero if the strings are equal; compareTo returns 0 exactly when the #equals(Object) method would return true.

This is the definition of lexicographic ordering. If two strings are different then either they have different characters at some index that is a valid index for both strings or their lengths are different or both. If they have different characters at one or more index positions let k be the smallest such index; then the string whose character at position k has the smaller value as determined by using the < operator lexicographically precedes the other string. In this case compareTo returns the difference of the two character values at position k in the two string -- that is the value:

 this.charAt(k)-anotherString.charAt(k) 
If there is no index position at which they differ then the shorter string lexicographically precedes the longer string. In this case compareTo returns the difference of the lengths of the strings -- that is the value:
 this.length()-anotherString.length() 
@param anotherString the String to be compared. @return the value 0 if the argument string is equal to this string; a value less than 0 if this string is lexicographically less than the string argument; and a value greater than 0 if this string is lexicographically greater than the string argument. @exception java.lang.NullPointerException if anotherString is null.
Class String, String copyValueOf(char[])

Returns a String that isrepresents equivalent to the specified character array. It creates a new array andsequence copiesin the characters intoarray itspecified. @param data the character array. @return a String that contains the characters of the character array.
Class String, String copyValueOf(char[], int, int)

Returns a String that isrepresents equivalent to the specified character array. It creates a new array andsequence copiesin the characters intoarray itspecified. @param data the character array. @param offset initial offset of the subarray. @param count length of the subarray. @return a String that contains the characters of the specified subarray of the character array.
Class String, byte[] getBytes()

ConvertEncodes this String into bytesa sequence of according tobytes using the platform's default character encodingcharset storing the result into a new byte array.

The behavior of this method when this string cannot be encoded in the default charset is unspecified. The java.nio.charset.CharsetEncoder class should be used when more control over the encoding process is required. @return theThe resultant byte array. @since JDK1.1

Class String, byte[] getBytes(String)

ConvertEncodes this String into bytesa according to the specified charactersequence of bytes using the encodingnamed charset storing the result into a new byte array.

The behavior of this method when this string cannot be encoded in the given charset is unspecified. The java.nio.charset.CharsetEncoder class should be used when more control over the encoding process is required. @param enc ThecharsetName the name of a supported character encodingcharset @return The resultant byte array @exception UnsupportedEncodingException If the named encodingcharset is not supported @since JDK1.1

Class String, void getBytes(int, int, byte[], int)

Copies characters from this string into the destination byte array. Each byte receives the 8 low-order bits of the corresponding character. The eight high-order bits of each character are not copied and do not participate in the transfer in any way.

The first character to be copied is at index srcBegin; the last character to be copied is at index srcEnd-1. The total number of characters to be copied is srcEnd-srcBegin. The characters converted to bytes are copied into the subarray of dst starting at index dstBegin and ending at index:

 dstbegin + (srcEnd-srcBegin) - 1 
@deprecated This method does not properly convert characters into bytes. As of JDK 1.1 the preferred way to do this is via the getBytes(String enc) method which takes a character-encoding name or the getBytes() method which uses the platform's default encodingcharset. @param srcBegin index of the first character in the string to copy. @param srcEnd index after the last character in the string to copy. @param dst the destination array. @param dstBegin the start offset in the destination array. @exception IndexOutOfBoundsException if any of the following is true:
  • srcBegin is negative
  • srcBegin is greater than srcEnd
  • srcEnd is greater than the length of this String
  • dstBegin is negative
  • dstBegin+(srcEnd-srcBegin) is larger than dst.length
@exception NullPointerException if dst is null
Class String, int hashCode()

Returns a hashcodehash code for this string. The hashcodehash code for a String object is computed as
 s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] 
using int arithmetic where s[i] is the ith character of the string n is the length of the string and ^ indicates exponentiation. (The hash value of the empty string is zero.) @return a hash code value for this object.
Class String, int indexOf(String, int)

Returns the index within this string of the first occurrence of the specified substring starting at the specified index. The integer returned is the smallest value k such thatfor which:
 thisk >= Math.startsWithmin(strfromIndex kstr.length()) && this.startsWith(k =str fromIndexk) 
is true. There isIf no restriction on thesuch value of fromIndex. If it is negative it has the same effect as if it were zero: this entire string may be searched. If it is greater than the length of this string it has the same effect as if it were equal to the length ofk thisexists string:then -1 is returned. @param str the substring for which to search for. @param fromIndex the index from which to start the search from. @return If the string argument occurs as a substringindex within this object at a starting index no smaller than fromIndex then the indexstring of the first characteroccurrence of the first such substring is returned. If it does not occur as aspecified substring starting at fromIndex or beyond -1the is returnedspecified index. @exception java.lang.NullPointerException if str is null.
Class String, int indexOf(int, int)

Returns the index within this string of the first occurrence of the specified character starting the search at the specified index.

If a character with value ch occurs in the character sequence represented by this String object at an index no smaller than fromIndex then the index of the first such occurrence is returned--that is the smallest value k such that:

 (this.charAt(k) == ch) && (k >= fromIndex) 
is true. If no such character occurs in this string at or after position fromIndex then -1 is returned.

There is no restriction on the value of fromIndex. If it is negative it has the same effect as if it were zero: this entire string may be searched. If it is greater than the length of this string it has the same effect as if it were equal to the length of this string: -1 is returned. @param ch a character. @param fromIndex the index to start the search from. @return the index of the first occurrence of the character in the character sequence represented by this object that is greater than or equal to fromIndex or -1 if the character does not occur.

Class String, String intern()

Returns a canonical representation for the string object.

A pool of strings initially empty is maintained privately by the class String.

When the intern method is invoked if the pool already contains a string equal to this String object as determined by the #equals(Object) method then the string from the pool is returned. Otherwise this String object is added to the pool and a reference to this String object is returned.

It follows that for any two strings s and t s.intern() == t.intern() is true if and only if s.equals(t) is true.

All literal strings and string-valued constant expressions are interned. String literals are defined in #§3.10.5 of the Java Language Specification @return a string that has the same contents as this string but is guaranteed to be from a pool of unique strings.

Class String, int lastIndexOf(String, int)

Returns the index within this string of the last occurrence of the specified substring. The returned index indicates the start ofsearching backward starting at the substring and it must be equal to or less thanspecified fromIndexindex. That is theThe indexinteger returned is the largest value k such that:
 thisk <= Math.startsWithmin(strfromIndex kstr.length()) && this.startsWith(k str fromIndexk) 
If no such value of k exists then -1 is returned. @param str the substring to search for. @param fromIndex the index to start the search from. There is no restriction on the value of fromIndex. If it is greater than the length of this string it has the same effect as if it were equal to the length of this string: this entire string may be searched. If it is negative it has the same effect as if it were -1: -1 is returned. @return If the string argument occurs one or more times as a substringindex within this object at a starting index no greater than fromIndex then the indexstring of the first characterlast occurrence of the last such substring is returned. If it does not occur as aspecified substring starting at fromIndex or earlier -1 is returned. @exception java.lang.NullPointerException if str is null.
Class String, int lastIndexOf(int, int)

Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index. That is the index returned is the largest value k such that:
 this.charAt(k) == ch) && (k <= fromIndex) 
is true. @param ch a character. @param fromIndex the index to start the search from. There is no restriction on the value of fromIndex. If it is greater than or equal to the length of this string it has the same effect as if it were equal to one less than the length of this string: this entire string may be searched. If it is negative it has the same effect as if it were -1: -1 is returned. @return the index of the last occurrence of the character in the character sequence represented by this object that is less than or equal to fromIndex or -1 if the character does not occur before that point.
Class String, boolean regionMatches(int, String, int, int)

Tests if two string regions are equal.

A substring of this String object is compared to a substring of the argument other. The result is true if these substrings represent identical character sequences. The substring of this String object to be compared begins at index toffset and has length len. The substring of other to be compared begins at index ooffset and has length len. The result is false if and only if at least one of the following is true:

  • toffset is negative.
  • ooffset is negative.
  • toffset+len is greater than the length of this String object.
  • ooffset+len is greater than the length of the other argument.
  • There is some nonnegative integer k less than len such that: this.charAt(toffset+k)  = other.charAt(ooffset+k)
@param toffset the starting offset of the subregion in this string. @param other the string argument. @param ooffset the starting offset of the subregion in the string argument. @param len the number of characters to compare. @return true if the specified subregion of this string exactly matches the specified subregion of the string argument; false otherwise. @exception java.lang.NullPointerException if other is null.
Class String, boolean startsWith(String)

Tests if this string starts with the specified prefix. @param prefix the prefix. @return true if the character sequence represented by the argument is a prefix of the character sequence represented by this string; false otherwise. Note also that true will be returned if the argument is an empty string or is equal to this String object as determined by the #equals(Object) method. @exception java.lang.NullPointerException if prefix is null. @since JDK11. 0
Class String, String toLowerCase()

Converts all of the characters in this String to lower case using the rules of the default locale which is returned by Locale.getDefault. If no character in the string has a different lowercase version based on calling the toLowerCase method definedThis by Character then the original string is returned. Otherwise this method creates a new String object that represents a character sequence identical in length to the characterequivalent sequence represented by this String object with every character equal to the result of applying the method Character.toLowerCase to the corresponding character of thiscalling String object. Examples: "French Fries".toLowerCase() returns "french fries" ""Locale.toLowerCasegetDefault() returns "").

@return the stringString converted to lowercase. @see java.lang.Character#toLowerCase(char) @see java.lang.String#toLowerCase(Locale)

Class String, String toLowerCase(Locale)

Converts all of the characters in this String to lower case using the rules of the given Locale. UsuallyCase mappings rely heavily on the charactersUnicode specification's character data. Since case mappings are convertednot always by1:1 char mappings the callingresulting Character.toLowerCaseString may be a different length than the original String. Exceptions to this rule are listed

Examples of lowercase mappings are in the following table:
Language Code of Locale Upper Case Lower Case Description
tr (Turkish) \u0130 \u0069 capital letter I with dot above -> small letter i
tr (Turkish) \u0049 \u0131 capital letter I -> small letter dotless i
(all) French Fries french fries lowercased all chars in String
(all) lowercased all chars in String
@param locale use the case transformation rules for this locale @return the String converted to lowercase. @see java.lang.CharacterString#toLowerCase(char) @see java.lang.String#toUpperCase() @see java.lang.String#toUpperCase(Locale) @since JDK11.1

Class String, String toUpperCase()

Converts all of the characters in this String to upper case using the rules of the default locale which is returned by Locale.getDefault. If no character in this stringThis has a different uppercase version based on calling the toUpperCase method defined by Character then the original string is returned. Otherwise this method creates a new String object representing a character sequence identical in length to the character sequence represented by this String object and with every character equal to the result of applying the method Character.toUpperCaseequivalent to the corresponding character of this String object. Examples: "Fahrvergnügen".toUpperCase() returns "FAHRVERGNÜGEN" "Visit Ljubinje "Locale.toUpperCasegetDefault() returns "VISIT LJUBINJE ").

@return the stringString converted to uppercase. @see java.lang.Character#toUpperCase(char) @see java.lang.String#toUpperCase(Locale)

Class String, String toUpperCase(Locale)

Converts all of the characters in this String to upper case using the rules of the given localeLocale. UsuallyCase mappings rely heavily on the charactersUnicode specification's character data. Since case mappings are convertednot always 1:1 char mappings by callingthe resulting Character.toUpperCaseString may be a different length than the original String. Exceptions to this

Examples of rulelocale-sensitive areand 1:M listedcase mappings are in the following table:.

Language Code of Locale Lower Case Upper Case Description
tr (Turkish) \u0069 \u0130 small letter i -> capital letter I with dot above
tr (Turkish) \u0131 \u0049 small letter dotless i -> capital letter I
(all) \u00df \u0053 \u0053 small letter sharp s -> two letters: SS
(all) Fahrvergnügen FAHRVERGNÜGEN
@param locale use the case transformation rules for this locale @return the String converted to uppercase. @see java.lang.CharacterString#toUpperCase(char) @see java.lang.String#toLowerCase() @see java.lang.String#toLowerCase(Locale) @since JDK11.1

Class String, String trim()

Removes white space from both ends of thisReturns a copy of the string with leading stringand trailing whitespace omitted.

If this String object represents an empty character sequence or the first and last characters of character sequence represented by this String object both have codes greater than '\u0020' (the space character) then a reference to this String object is returned.

Otherwise if there is no character with a code greater than '\u0020' in the string then a new String object representing an empty string is created and returned.

Otherwise let k be the index of the first character in the string whose code is greater than '\u0020' and let m be the index of the last character in the string whose code is greater than '\u0020'. A new String object is created representing the substring of this string that begins with the character at index k and ends with the character at index m-that is the result of this.substring(k  m+1).

This method may be used to trim whitespace from the beginning and end of a string; in fact it trims all ASCII control characters as well. @return A copy of this string with leading and trailing white space removed from the front andor this string if endit has no leading or trailing white space.

Class String, String valueOf(char)

Returns the string representation of the char argument. @param c a char. @return a newly allocated string of length 1 containing as its single character the argument c.
Class String, String valueOf(char[], int, int)

Returns the string representation of a specific subarray of the char array argument.

The offset argument is the index of the first character of the subarray. The count argument specifies the length of the subarray. The contents of the subarray are copied; subsequent modification of the character array does not affect the newly created string. @param data the character array. @param offset the initial offset into the value of the String. @param count the length of the value of the String. @return a newly allocated string representing the sequence of characters contained in the subarray of the character array argument. @exception NullPointerException if data is null. @exception IndexOutOfBoundsException if offset is negative or count is negative or offset+count is larger than data.length.

Class String, String valueOf(double)

Returns the string representation of the double argument.

The representation is exactly the one returned by the Double.toString method of one argument. @param d a double. @return a newly allocated string containing a string representation of the double argument. @see java.lang.Double#toString(double)

Class String, String valueOf(float)

Returns the string representation of the float argument.

The representation is exactly the one returned by the Float.toString method of one argument. @param f a float. @return a newly allocated string containing a string representation of the float argument. @see java.lang.Float#toString(float)

Class String, String valueOf(int)

Returns the string representation of the int argument.

The representation is exactly the one returned by the Integer.toString method of one argument. @param i an int. @return a newly allocated string containing a string representation of the int argument. @see java.lang.Integer#toString(int int)

Class String, String valueOf(long)

Returns the string representation of the long argument.

The representation is exactly the one returned by the Long.toString method of one argument. @param l a long. @return a newly allocated string containing a string representation of the long argument. @see java.lang.Long#toString(long)

Class String, Comparator CASE_INSENSITIVE_ORDER

ReturnsA a Comparator that orders String objects as by compareToIgnoreCase. This comparator is serializable.

Note that this Comparator does not take locale into account and will result in an unsatisfactory ordering for certain locales. The java.text package provides Collators to allow locale-sensitive ordering. @return Comparator for case insensitive comparison of strings @see java.text.Collator#compare(String String) @since 1.2


Class StringBuffer

A string buffer implements a mutable sequence of characters. A string buffer is like a String but can be modified. At any point in time it contains some particular sequence of characters but the length and content of the sequence can be changed through certain method calls.

String buffers are safe for use by multiple threads. The methods are synchronized where necessary so that all the operations on any particular instance behave as if they occur in some serial order that is consistent with the order of the method calls made by each of the individual threads involved.

String buffers are used by the compiler to implement the binary string concatenation operator +. For example the code:

 x = "a" + 4 + "c" 

is compiled to the equivalent of:

 x = new StringBuffer().append("a").append(4).append("c") .toString() 
which creates a new string buffer (initially empty) appends the string representation of each operand to the string buffer in turn and then converts the contents of the string buffer to a string. Overall this avoids creating many temporary strings.

The principal operations on a StringBuffer are the append and insert methods which are overloaded so as to accept data of any type. Each effectively converts a given datum to a string and then appends or inserts the characters of that string to the string buffer. The append method always adds these characters at the end of the buffer; the insert method adds the characters at a specified point.

For example if z refers to a string buffer object whose current contents are "start" then the method call z.append("le") would cause the string buffer to contain "startle" whereas z.insert(4 "le") would alter the string buffer to contain "starlet".

In general if sb refers to an instance of a StringBuffer then sb.append(x) has the same effect as sb.insert(sb.length()  x).

Every string buffer has a capacity. As long as the length of the character sequence contained in the string buffer does not exceed the capacity it is not necessary to allocate a new internal buffer array. If the internal buffer overflows it is automatically made larger. @author Arthur van Hoff @version 1.62 0470 12/2103/0001 @see java.io.ByteArrayOutputStream @see java.lang.String @since JDK1.0

Class StringBuffer, StringBuffer reverse()

The character sequence contained in this string buffer is replaced by the reverse of the sequence.

Let n be the length of the old character sequence the one contained in the string buffer just prior to execution of the reverse method. Then the character at index k in the new character sequence is equal to the character at index n-k-1 in the old character sequence. @return a reference to this StringBuffer object.. @since JDK1.0.2


Class StringIndexOutOfBoundsException

Thrown by the charAt method in class String and by other String methods to indicate that an index is either negative or greater than orthe size of the string. For some methods such as the charAt method this exception also is thrown when the index is equal to the size of the string. @author unascribed @version 1.18 0220 12/0203/0001 @see java.lang.String#charAt(int) @since JDK1.0

Class System

The System class contains several useful class fields and methods. It cannot be instantiated.

Among the facilities provided by the System class are standard input standard output and error output streams; access to externally defined "properties"; a means of loading files and libraries; and a utility method for quickly copying a portion of an array. @author Arthur van Hoff @version 1.111 02125 12/0203/0001 @since JDK1.0

Class System, void arraycopy(Object, int, Object, int, int)

Copies an array from the specified source array beginning at the specified position to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dstdest. The number of components copied is equal to the length argument. The components at positions srcOffsetsrcPos through srcOffsetsrcPos+length-1 in the source array are copied into positions dstOffsetdestPos through dstOffsetdestPos+length-1 respectively of the destination array.

If the src and dstdest arguments refer to the same array object then the copying is performed as if the components at positions srcOffsetsrcPos through srcOffsetsrcPos+length-1 were first copied to a temporary array with length components and then the contents of the temporary array were copied into positions dstOffsetdestPos through dstOffsetdestPos+length-1 of the destination array.

If dstdest is null then a NullPointerException is thrown.

If src is null then a NullPointerException is thrown and the destination array is not modified.

Otherwise if any of the following is true an ArrayStoreException is thrown and the destination is not modified:

  • The src argument refers to an object that is not an array.
  • The dstdest argument refers to an object that is not an array.
  • The src argument and dstdest argument refer to arrays whose component types are different primitive types.
  • The src argument refers to an array with a primitive component type and the dstdest argument refers to an array with a reference component type.
  • The src argument refers to an array with a reference component type and the dstdest argument refers to an array with a primitive component type.

Otherwise if any of the following is true an IndexOutOfBoundsException is thrown and the destination is not modified:

  • The srcOffsetsrcPos argument is negative.
  • The dstOffsetdestPos argument is negative.
  • The length argument is negative.
  • srcOffsetsrcPos+length is greater than src.length the length of the source array.
  • dstOffsetdestPos+length is greater than dstdest.length the length of the destination array.

Otherwise if any actual component of the source array from position srcOffsetsrcPos through srcOffsetsrcPos+length-1 cannot be converted to the component type of the destination array by assignment conversion an ArrayStoreException is thrown. In this case let k be the smallest nonnegative integer less than length such that src[srcOffsetsrcPos+k] cannot be converted to the component type of the destination array; when the exception is thrown source array components from positions srcOffsetsrcPos through srcOffsetsrcPos+k-1 will already have been copied to destination array positions dstOffsetdestPos through dstOffsetdestPos+k-1 and no other positions of the destination array will have been modified. (Because of the restrictions already itemized this paragraph effectively applies only to the situation where both arrays have component types that are reference types.) @param src the source array. @param src_positionsrcPos startstarting position in the source array. @param dstdest the destination array. @param dst_position posdestPos startstarting position in the destination data. @param length the number of array elements to be copied. @exception IndexOutOfBoundsException if copying would cause access of data outside array bounds. @exception ArrayStoreException if an element in the src array could not be stored into the dest array because of a type mismatch. @exception NullPointerException if either src or dstdest is null.

Class System, long currentTimeMillis()

Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond the granularity of the value depends on the underlying operating system and may be larger. For example many operating systems measure time in units of tens of milliseconds.

See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" and coordinated universal time (UTC). @return the difference measured in milliseconds between the current time and midnight January 1 1970 UTC. @see java.util.Date

Class System, Properties getProperties()

Determines the current system properties.

First if there is a security manager its checkPropertiesAccess method is called with no arguments. This may result in a security exception.

The current set of system properties for use by the #getProperty(String) method is returned as a Properties object. If there is no current set of system properties a set of system properties is first created and initialized. This set of system properties always includes values for the following keys:
Key Description of Associated Value
java.version Java Runtime Environment version
java.vendor Java Runtime Environment vendor
java.vendor.url Java vendor URL
java.home Java installation directory
java.vm.specification.version Java Virtual Machine specification version
java.vm.specification.vendor Java Virtual Machine specification vendor
java.vm.specification.name Java Virtual Machine specification name
java.vm.version Java Virtual Machine implementation version
java.vm.vendor Java Virtual Machine implementation vendor
java.vm.name Java Virtual Machine implementation name
java.specification.version Java Runtime Environment specification version
java.specification.vendor Java Runtime Environment specification vendor
java.specification.name Java Runtime Environment specification name
java.class.version Java class format version number
java.class.path Java class path
java.library.path List of paths to search when loading libraries
java.io.tmpdir Default temp file path
java.compiler Name of JIT compiler to use
java.ext.dirs Path of extension directory or directories
os.name Operating system name
os.arch Operating system architecture
os.version Operating system version
file.separator File separator ("/" on UNIX)
path.separator Path separator (":" on UNIX)
line.separator Line separator ("\n" on UNIX)
user.name User's account name
user.home User's home directory
user.dir User's current working directory

Multiple paths in a system property value are separated by the path separator character of the platform.

Note that even if the security manager does not permit the getProperties operation it may choose to permit the #getProperty(String) operation. @return the system properties @exception SecurityException if a security manager exists and its checkPropertiesAccess method doesn't allow access to the system properties. @see #setProperties @see java.lang.SecurityException @see java.lang.SecurityManager#checkPropertiesAccess() @see java.util.Properties

Class System, int identityHashCode(Object)

Returns the same hashcodehash code for the given object as would be returned by the default method hashCode() whether or not the given object's class overrides hashCode(). The hashcodehash code for the null reference is zero. @param x object for which the hashCode is to be calculated @return the hashCode @since JDK1.1
Class System, void load(String)

Loads a code file with the specified filename from the local file system as a dynamic library. The filename argument must be a complete pathnamepath name.

The call System.load(name) is effectively equivalent to the call:

 Runtime.getRuntime().load(name) 
@param filename the file to load. @exception SecurityException if a security manager exists and its checkLink method doesn't allow loading of the specified dynamic library @exception UnsatisfiedLinkError if the file does not exist. @see java.lang.Runtime#load(java.lang.String) @see java.lang.SecurityManager#checkLink(java.lang.String)

Class Thread

A thread is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently.

Every thread has a priority. Threads with higher priority are executed in preference to threads with lower priority. Each thread may or may not also be marked as a daemon. When code running in some thread creates a new Thread object the new thread has its priority initially set equal to the priority of the creating thread and is a daemon thread if and only if the creating thread is a daemon.

When a Java Virtual Machine starts up there is usually a single non-daemon thread (which typically calls the method named main of some designated class). The Java Virtual Machine continues to execute threads until either of the following occurs:

  • The exit method of class Runtime has been called and the security manager has permitted the exit operation to take place.
  • All threads that are not daemon threads have died either by returning from the call to the run method or by throwing an exception that propagates beyond the run method.

There are two ways to create a new thread of execution. One is to declare a class to be a subclass of Thread. This subclass should override the run method of class Thread. An instance of the subclass can then be allocated and started. For example a thread that computes primes larger than a stated value could be written as follows:


 class PrimeThread extends Thread { long minPrime; PrimeThread(long minPrime) { this.minPrime = minPrime; } public void run() { // compute primes larger than minPrime  . . . } } 

The following code would then create a thread and start it running:

 PrimeThread p = new PrimeThread(143); p.start(); 

The other way to create a thread is to declare a class that implements the Runnable interface. That class then implements the run method. An instance of the class can then be allocated passed as an argument when creating Thread and started. The same example in this other style looks like the following:


 class PrimeRun implements Runnable { long minPrime; PrimeRun(long minPrime) { this.minPrime = minPrime; } public void run() { // compute primes larger than minPrime  . . . } } 

The following code would then create a thread and start it running:

 PrimeRun p = new PrimeRun(143); new Thread(p).start(); 

Every thread has a name for identification purposes. More than one thread may have the same name. If a name is not specified when a thread is created a new name is generated for it. @author unascribed @version 1.107 08125 12/2503/01 @see java.lang.Runnable @see java.lang.Runtime#exit(int) @see java.lang.Thread#run() @see java.lang.Thread#stop() @since JDK1.0

Class Thread, constructor Thread()

Allocates a new Thread object. This constructor has the same effect as Thread(null null gname) where gname is a newly generated name. Automatically generated names are of the form "Thread-"+n where n is an integer. Threads created this way must have overridden their run() method to actually do anything. An example illustrating this method being used follows: import java.lang.*; class plain01 implements Runnable { String name; plain01() { name = null; } plain01(String s) { name = s; } public void run() { if (name == null) System.out.println("A new thread created"); else System.out.println("A new thread with name " + name + " created"); } } class threadtest01 { public static void main(String args[] ) { int failed = 0 ; Thread t1 = new Thread(); if (t1 = null) System.out.println("new Thread() succeed"); else { System.out.println("new Thread() failed"); failed++; } } } @see java.lang.Thread#Thread(java.lang.ThreadGroup java.lang.Runnable java.lang.String)
Class Thread, constructor Thread(ThreadGroup, Runnable, String)

Allocates a new Thread object so that it has target as its run object has the specified name as its name and belongs to the thread group referred to by group.

If group is null and there is a security manager the group is determined by the security manager's getThreadGroup method. If group is null and there is not a security manager or the security manager's getThreadGroup method returns null the group is set to be the same ThreadGroup as the thread that is creating the new thread.

If there is a security manager its checkAccess method is called with the ThreadGroup as its argument. This may result in a SecurityException.

If the target argument is not null the run method of the target is called when this thread is started. If the target argument is null this thread's run method is called when this thread is started.

The priority of the newly created thread is set equal to the priority of the thread creating it that is the currently running thread. The method setPriority may be used to change the priority to a new value.

The newly created thread is initially marked as being a daemon thread if and only if the thread creating it is currently marked as a daemon thread. The method setDaemon may be used to change whether or not a thread is a daemon. @param group the thread group. @param target the object whose run method is called. @param name the name of the new thread. @exception SecurityException if the current thread cannot create a thread in the specified thread group. @see java.lang.Runnable#run() @see java.lang.Thread#run() @see java.lang.Thread#setDaemon(boolean) @see java.lang.Thread#setPriority(int) @see java.lang.ThreadGroup#checkAccess() @see SecurityManager#checkAccess

Class Thread, int activeCount()

Returns the current number of active threads in thisthe current thread's thread group. @return the current number of active threads in thisthe current thread's thread group.
Class Thread, int enumerate(Thread[])

Copies into the specified array every active thread in thisthe current thread's thread group and its subgroups. This method simply calls the enumerate method of thisthe current thread's thread group with the array argument.

First if there is a security manager that enumerate method calls the security manager's checkAccess method with the thread group as its argument. This may result in throwing a SecurityException. @param tarray an array of Thread objects to copy to @return the number of threads put into the array @exception SecurityException if a security manager exists and its checkAccess method doesn't allow the operation. @see java.lang.ThreadGroup#enumerate(java.lang.Thread[]) @see java.lang.SecurityManager#checkAccess(java.lang.ThreadGroup)

Class Thread, int getPriority()

Returns this thread's priority. @return this thread's namepriority. @see #setPriority @see java.lang.Thread#setPriority(int)
Class Thread, void interrupt()

Interrupts this thread.

First the checkAccess method of this thread is calledinvoked withwhich may cause noa SecurityException argumentsto be thrown. This

If maythis thread is resultblocked in throwingan ainvocation SecurityExceptionof the wait() wait(long) or int wait(long int)} methods of the Object class or of the #join() #join(long) int) #sleep(long) or int) methods of this class then its interrupt status will be cleared and it will receive an InterruptedException

If this thread is blocked in an I/O operation upon an interruptibl channel} then the channel will be closed the thread's interrupt status will be set and the thread will receive a java.nio.channels.ClosedByInterruptException

If this thread is blocked in a java.nio.channels.Selector then the thread's interrupt status will be set and it will return immediately from the selection operation possibly with a non-zero value just as if the selector's wakeup method were invoked.

If none of the previous conditions hold then this thread's interrupt status will be set.

@exceptionthrows SecurityException if the current thread cannot modify this thread @revised 1.4 @spec JSR-51

Class ThreadDeath

An instance of ThreadDeath is thrown in the victim thread when the stop method with zero arguments in class Thread is called.

An application should catch instances of this class only if it must clean up after being terminated asynchronously. If ThreadDeath is caught by a method it is important that it be rethrown so that the thread actually dies.

The top-level error handler does not print out a message if ThreadDeath is never caught.

The class ThreadDeath is specifically a subclass of Error rather than Exception even though it is a "normal occurrence" because many applications catch all occurrences of Exception and then discard the exception. @author unascribed @version 1.12 0213 12/0203/0001 @see java.lang.Thread#stop() @since JDK1.0


Class ThreadGroup

A thread group represents a set of threads. In addition a thread group can also include other thread groups. The thread groups form a tree in which every thread group except the initial thread group has a parent.

A thread is allowed to access information about its own thread group but not to access information about its thread group's parent thread group or any other thread groups. @author unascribed @version 1.51 0254 12/0203/0001 @since JDK1.0

Class ThreadGroup, void setMaxPriority(int)

Sets the maximum priority of the group. Threads in the thread group that already have a higher priority are not affected.

First the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

ThreadsIf inthe pri argument is less than Thread#MIN_PRIORITY or greater than Thread#MAX_PRIORITY the maximum priority of the group remains unchanged.

Otherwise the priority of this ThreadGroup object is set to the smaller of the specified pri and the maximum permitted priority of the parent of this thread group. that(If already have athis thread group higheris the system thread group which has no parent then its maximum priority are notis simply affectedset to pri.) Then this method is called recursively with pri as its argument for every thread group that belongs to this thread group. @param pri the new priority of the thread group. @exception SecurityException if the current thread cannot modify this thread group. @see #getMaxPriority @see java.lang.SecurityException @see java.lang.ThreadGroup#checkAccess() @since JDK1.0


Class ThreadLocal

This class provides ThreadLocalthread-local variables. These variables differ from their normal counterparts in that each thread that accesses one (via its get or set method) has its own independently initialized copy of the variable. ThreadLocal objectsinstances are typically private static variablesfields in classes that wish to associate state with a thread (e.g. a user ID or Transaction ID).

For example in the class below the private static ThreadLocal instance (serialNum) maintains a "serial number" for each thread that invokes the class's static SerialNum.get() method which returns the current thread's serial number. (A thread's serial number is assigned the first time it invokes SerialNum.get() and remains unchanged on subsequent calls.)

 public class SerialNum { // The next serial number to be assigned private static int nextSerialNum = 0; private static ThreadLocal serialNum = new ThreadLocal() { protected synchronized Object initialValue() { return new Integer(nextSerialNum++); } }; public static int get() { return ((Integer) (serialNum.get())).intValue(); } } 

Each thread holds an implicit reference to its copy of a ThreadLocalthread-local variable as long as the thread is alive and the ThreadLocal objectinstance is accessible; after a thread goes away all of its copies of ThreadLocalthread-local variablesinstances are subject to garbage collection (unless other references to these copies exist). @author Josh Bloch and Doug Lea @version 1.16 0219 12/0203/0001 @since 1.2

Class ThreadLocal, Object get()

Returns the value in the callingcurrent thread's copy of this ThreadLocalthread-local variable. Creates and initializes the copy if this is the first time the thread has called this method. @return the current thread's value of this ThreadLocalthread-local
Class ThreadLocal, Object initialValue()

Returns the callingcurrent thread's initial value for this ThreadLocalthread-local variable. This method will be called once per accessing thread for each ThreadLocalthread-local the first time each thread accesses the variable with the #get() or #set(Object) method. If the programmer desires ThreadLocalthread-local variables to be initialized to some value other than null ThreadLocal must be subclassed and this method overridden. Typically an anonymous inner class will be used. Typical implementations of initialValue will call an appropriate constructor and return the newly constructed object. @return the initial value for this ThreadLocalthread-local
Class ThreadLocal, void set(Object)

Sets the callingcurrent thread's instancecopy of this ThreadLocalthread-local variable to the givenspecified value. This is only used to change the value from the one assigned by the initialValue method and many applications will have no need for this functionality. @param value the value to be stored in the callingcurrent threads' copy of this ThreadLocalthread-local.

Class Throwable

The Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or of one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement. Similarly only this class or one of its subclasses can be the argument type in a catch clause.

Instances of two subclasses java.lang.Error and java.lang.Exception are conventionally used to indicate that exceptional situations have occurred. Typically these instances are freshly created in the context of the exceptional situation so as to include relevant information (such as stack trace data).

A By convention classthrowable contains a Throwablesnapshot andof the execution stack of its subclasses have two constructors one thatthread at the time it was takescreated. no arguments andIt can also onecontain a message string that takesgives more information about the error. Finally it can contain a Stringcause: argumentanother throwable that caused this throwable to get thrown. The cause facility is new in release 1.4. It is also known as the chained exception facility as the cause can beitself usedhave a cause and so on leading to producea an"chain" errorof messageexceptions each caused by another.

One Areason Throwablethat a throwable may have a cause is that the class containsthat throws it is built atop a snapshotlower layered abstraction and an operation on the upper layer fails due to a failure in the lower layer. It would be bad design to let the throwable thrown by the lower layer propagate outward as it is generally unrelated to the abstraction provided by the upper layer. Further doing so would tie the API of the executionupper stacklayer to the details of its thread atimplementation assuming the timelower itlayer's exception was createda checked exception. It canThrowing a also"wrapped containexception" (i.e. an exception containing a messagecause) string that gives more information aboutallows the upper layer to communicate the errordetails of the failure to its caller without incurring either of these shortcomings. It preserves the flexibility to change the implementation of the upper layer without changing its API (in particular the set of exceptions thrown by its methods).

A second reason that a Herethrowable may have a cause is onethat the method that throws it must conform to a general-purpose interface that does not permit the method to throw the cause directly. For example suppose a persistent collection conforms to the Collection interface and that its persistence is implemented atop java.io. Suppose the internals of catchingthe put method can throw an IOException The implementation can communicate the details of the IOException to its caller while conforming to the Collection interface by wrapping the IOException in an appropriate unchecked exception:. (The specification for the persistent collection should indicate that it is capable of throwing such exceptions.)

A cause can be associated with a throwable in two ways: via a constructor that takes the cause as an argument or via the #initCause(Throwable) method. New throwable classes that wish to allow causes to be associated with them should provide constructors that take a cause and delegate (perhaps indirectly) to one of the Throwable constructors that takes a cause. For example:

 try { intlowLevelOp(); a[]} catch LowLevelException(le) { =throw new int[2]HighLevelException(le); // Chaining-aware constructor } 
Because the initCause method is public it allows a[4] cause to be associated with any throwable even a "legacy throwable" whose implementation predates the addition of the exception chaining mechanism to Throwable. For example:
 try { lowLevelOp(); } catch LowLevelException(ArrayIndexOutOfBoundsException ele) { Systemthrow (HighLevelException) new HighLevelException().outinitCause(le); // Legacy constructor } 

Prior to release 1.println4 there were many throwables that had their own non-standard exception chaining mechanisms (" ExceptionInInitializerError ClassNotFoundException java.lang.reflect.UndeclaredThrowableException java.lang.reflect.InvocationTargetException java.io.WriteAbortedException java.security.PrivilegedActionException java.awt.print.PrinterIOException and A of release 1.4 all of these throwables have been retrofitted to use the standard exception: chaining mechanism while continuing to implement their "legacy" +chaining emechanisms for compatibility.

Further as of release 1.4 many general purpose Throwable classes (for example Exception RuntimeException hav been retrofitted with constructors that take a cause. This was not strictly necessary due to the existence of the initCause method but it is more convenient and expressive to delegate to a constructor that takes a cause.

By convention class Throwable and its subclasses have two constructors one that takes no arguments and one that takes a String argument that can be used to produce a detail message.getMessage Further those subclasses that might likely have a cause associated with them should have two more constructors one that takes a Throwable (the cause) and one that takes a String (the detail message) and a Throwable (the cause);. e

Also introduced in release 1.4 is the #getStackTrace() method which allows programmatic access to the stack trace information that was previously available only in text form via the various forms of the #printStackTrace(); }method. This information has been added to the serialized representation of this class so getStackTrace and printStackTrace will operate properly on a throwable that was obtained by deserialization. @author unascribed @author Josh Bloch (Added exception chaining and programmatic access to stack trace in 1.4.) @version 1.44 0249 12/0203/0001 @since JDK1.0

Class Throwable, constructor Throwable()

Constructs a new Throwablethrowable with null as its errordetail message string. Also theThe cause methodis not initialized and may subsequently be initialized by a call to #initCause

The #fillInStackTrace() method is called forto initialize the stack trace data in the newly this objectcreated throwable.

Class Throwable, constructor Throwable(String)

Constructs a new Throwablethrowable with the specified errordetail message. AlsoThe thecause methodis not initialized and may subsequently be initialized by a call to #initCause

The #fillInStackTrace() method is called forto initialize the stack trace data in the newly this objectcreated throwable. @param message the errordetail message. The errordetail message is saved for later retrieval by the #getMessage() method.

Class Throwable, Throwable fillInStackTrace()

Fills in the execution stack trace. This method records within this Throwable object information about the current state of the stack frames for the current thread. This method is useful when an application is re-throwing an error or exception. For example: try { a = b / c; } catch(ArithmeticThrowable e) {@return a = Double.MAX_VALUE; throw e.fillInStackTrace();reference }to @return this Throwable objectinstance. @see java.lang.Throwable#printStackTrace()
Class Throwable, String getLocalizedMessage()

Creates a localized description of this Throwablethrowable. Subclasses may override this method in order to produce a locale-specific message. For subclasses that do not override this method the default implementation returns the same result as getMessage(). @return The localized description of this Throwablethrowable. @since JDK1.1
Class Throwable, String getMessage()

Returns the errordetail message string of this throwable object. @return the errordetail message string of this Throwable object if it was createdinstance with(which an error message string;may or be null if it was created with no error message).
Class Throwable, void printStackTrace()

Prints this Throwablethrowable and its backtrace to the standard error stream. This method prints a stack trace for this Throwable object on the error output stream that is the value of the field System.err. The first line of output contains the result of the #toString() method for this object. Remaining lines represent data previously recorded by the method #fillInStackTrace() The format of this information depends on the implementation but the following example may be regarded as typical:
 java.lang.NullPointerException at MyClass.mash(MyClass.java:9) at MyClass.crunch(MyClass.java:6) at MyClass.main(MyClass.java:3) 
This example was produced by running the program:
 class MyClass { public static void main(String[] argvargs) { crunch(null); } static void crunch(int[] a) { mash(a); } static void mash(int[] b) { System.out.println(b[0]); } } 
The backtrace for a throwable with an initialized non-null cause should generally include the backtrace for the cause. The format of this information depends on the implementation but the following example may be regarded as typical: @see
 HighLevelException: MidLevelException: LowLevelException at Junk.a(Junk.java:13) at Junk.langmain(Junk.System#errjava:4) Caused by: MidLevelException: LowLevelException at Junk.c(Junk.java:23) at Junk.b(Junk.java:17) at Junk.a(Junk.java:11) ... 1 more Caused by: LowLevelException at Junk.e(Junk.java:30) at Junk.d(Junk.java:27) at Junk.c(Junk.java:21) ... 3 more 
Note the presence of lines containing the characters "...". These lines indicate that the remainder of the stack trace for this exception matches the indicated number of frames from the bottom of the stack trace of the exception that was caused by this exception (the "enclosing" exception). This shorthand can greatly reduce the length of the output in the common case where a wrapped exception is thrown from same method as the "causative exception" is caught. The above example was produced by running the program:
 public class Junk { public static void main(String args[]) { try { a(); } catch(HighLevelException e) { e.printStackTrace(); } } static void a() throws HighLevelException { try { b(); } catch(MidLevelException e) { throw new HighLevelException(e); } } static void b() throws MidLevelException { c(); } static void c() throws MidLevelException { try { d(); } catch(LowLevelException e) { throw new MidLevelException(e); } } static void d() throws LowLevelException { e(); } static void e() throws LowLevelException { throw new LowLevelException(); } } class HighLevelException extends Exception { HighLevelException(Throwable cause) { super(cause); } } class MidLevelException extends Exception { MidLevelException(Throwable cause) { super(cause); } } class LowLevelException extends Exception { } 
Class Throwable, void printStackTrace(PrintStream)

Prints this Throwablethrowable and its backtrace to the specified print stream. @param s PrintStream to use for output
Class Throwable, void printStackTrace(PrintWriter)

Prints this Throwablethrowable and its backtrace to the specified print writer. @param s PrintWriter to use for output @since JDK1.1
Class Throwable, String toString()

Returns a short description of this throwable object. If this Throwable object was created with ana non-null errordetail message string then the result is the concatenation of three strings:
  • The name of the actual class of this object
  • ": " (a colon and a space)
  • The result of the #getMessage method for this object
If this Throwable object was created with noa null errordetail message string then the name of the actual class of this object is returned. @return a string representation of this Throwablethrowable.

Class UnknownError

Thrown when an unknown but serious exception has occurred in the Java Virtual Machine. @author unascribed @version 1.10 0211 12/0203/0001 @since JDK1.0

Class UnsatisfiedLinkError

Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native. @author unascribed @version 1.18 0219 12/0203/0001 @see java.lang.Runtime @since JDK1.0

Class UnsupportedOperationException

Thrown to indicate that the requested operation is not supported. @author Josh Bloch @version 1.12 0213 12/0203/0001 @since 1.2

Class VerifyError

Thrown when the "verifier" detects that a class file though well formed contains some sort of internal inconsistency or security problem. @author unascribed @version 1.10 0211 12/0203/0001 @since JDK1.0

Class VirtualMachineError

Thrown to indicate that the Java Virtual Machine is broken or has run out of resources necessary for it to continue operating. @author Frank Yellin @version 1.11 0212 12/0203/0001 @since JDK1.0

Class Void

The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the primitive Java typekeyword void. @author unascribed @version 1.810 0212/0203/0001 @since JDK1.1