|
Generated by JDiff |
||||||||
| PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES | |||||||||
This file contains all the changes in documentation in the packagejava.langas colored differences. Deletions are shownlike 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.
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.13 0915 02/2102/9800 @since JDK1.0
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.17 0919 02/2102/9800 @since JDK1.0
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.16 0918 02/2102/9800 @since JDK1.0
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 anArrayStoreException:@author unascribed @version 1.Object x[] = new String[3]; x[0] = new Integer(0);6 098 02/2102/9800 @since JDK1.0
The Boolean class wraps a value of the primitive typeClass Boolean, boolean getBoolean(String)booleanin an object. An object of typeBooleancontains a single field whose type isboolean.In addition this class provides many methods for converting a
booleanto aStringand aStringto abooleanas well as other constants and methods useful when dealing with aboolean. @author Arthur van Hoff @version 1.29 0738 02/2302/9800 @since JDK1.0
ReturnsClass Boolean, Boolean valueOf(String)trueif and only if the system property named by the argument exists and is equal to the string"true". (Beginning with version 1.0.2 of the JavaTM platform the test of this string is case insensitive.) A system property is accessible throughgetPropertya method defined by theSystemclass.If there is no property with the specified name or if the specified name is empty or null then
falseis returned. @param name the system property name. @return thebooleanvalue of the system property. @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String java.lang.String)
ReturnstheaBooleanwithbooleana value represented by the specified String.A newTheBooleanobject is constructed. This Booleanreturned represents the valuetrueif the string argument is notnulland is equal ignoring case to the string"true".Example: Boolean.valueOf("True") returns true.
Example: Boolean.valueOf("yes") returns false. @param s a string. @return theBooleanvalue represented by the string.
The Byte class is the standard wrapper for byte values. @author Nakul Saraiya @version 1.Class Byte, int compareTo(Byte)13 0920 02/2102/9800 @see java.lang.Number @since JDK1.1
Compares two Bytes numerically. @param anotherByte theClass Byte, int compareTo(Object)Byteto be compared. @return the value0if the argument Byte is equal to this Byte; a value less than0if this Byte is numerically less than the Byte argument; and a value greater than0if this Byte is numerically greater than the Byte argument (signed comparison). @sinceJDK11.2
Compares this Byte to another Object. If the Object is a Byte this function behaves likeClass Byte, Byte decode(String)compareTo(Byte). Otherwise it throws aClassCastException(as Bytes are comparable only to other Bytes). @param o theObjectto be compared. @return the value0if the argument is a Byte numerically equal to this Byte; a value less than0if the argument is a Byte numerically greater than this Byte; and a value greater than0if the argument is a Byte numerically less than this Byte. @exceptionClassCastExceptionif the argument is not aByte. @see java.lang.Comparable @sinceJDK11.2
Decodes aClass Byte, byte parseByte(String)Stringinto aByte.The String may representAccepts decimal hexadecimal and octal numbers in the following formats:[-] decimal constant [-] 0x hex constant [-] # hex constant [-] 0 octal constantThe constant following an (optional) negative sign and/or "radix specifier" is parsed as by theByte.parseBytemethod with the specified radix (10 8 or 16). This constant must be positive or a NumberFormatException will result. The result is made negative if first character of the specifiedStringis the negative sign. No whitespace characters are permitted in theString. @param nm thestringStringto decode. @return theByterepresented by the specified string. @exception NumberFormatException if theStringdoes not contain a parsable byte. @see java.lang.Byte#parseByte(String int)
Assuming the specified String represents a byte returns that byte's value. Throws an exception if the String cannot be parsed as a byte. The radix is assumed to be 10. @param s the String containing the byte @return the parsed value of the byte @exception NumberFormatException If the string does not contain a parsable byte.Class Byte, byte parseByte(String, int)
Assuming the specified String represents a byte returns that byte's value. Throws an exception if the String cannot be parsed as a byte. @param s the String containing the byte @param radix the radix to be used @return the parsed value of the byte @exception NumberFormatException If the String does not contain a parsable byte.Class Byte, String toString(byte)
Returns a new String object representing the specified Byte. The radix is assumed to be 10. @param b the byte to be converted @return the string representation of the specified byte
Class Byte, Byte valueOf(String)Assuming the specified String represents a byte returns a new Byte object initialized to that value. Throws an exception if the String cannot be parsed as a byte. The radix is assumed to be 10. @param s the String containing the integer @return theClass Byte, Byte valueOf(String, int)Byteinstance representing the parsedbytevalue @exception NumberFormatException If the String does not contain a parsable byte.
Assuming the specified String represents a byte returns a new Byte object initialized to that value. Throws an exception if the String cannot be parsed as a byte. @param s the String containing the integer @param radix the radix to be used @return theByteinstance representing the parsedbytevalue @exception NumberFormatException If the String does not contain a parsable byte.
The Character class wraps a value of the primitive typecharin an object. An object of typeCharactercontains a single field whose type ischar.In addition this class provides several methods for determining the type of a character and converting characters from uppercase to lowercase and vice versa.
Many of the methods of class
Characterare defined in terms of a "Unicode attribute table" that specifies a name for every defined Unicode code point. The table also includes other attributes such as a decimal value an uppercase equivalent a lowercase equivalent and/or a titlecase equivalent. The character attribute tables for specific versions of Unicode are available on the World Wide Web in various subdirectories of:ftp://ftp.unicode.org/Public/For a more detailed specification of the
Characterclass one that encompasses the exact behavior of methods such asisDigitisLetterisLowerCaseandisUpperCaseover the full range of Unicode values see Gosling Joy and Steele The Java Language Specification. @author Lee Boynton @author Guy Steele @author Akira Tanaka @version 1.55 9861 02/0902/1600 @since JDK1.0
Instances of this class represent particular subsets of the Unicode character set. The only family of subsets defined in theCharacterclass is{@link Character.UnicodeBlock UnicodeBlock}. Other portions of the Java API may define other subsets for their own purposes. @sinceJDK11.2
A family of character subsets representing the character blocks defined by the Unicode 2.0 specification. Any given character is contained by at most one Unicode block. @sinceJDK11.2
Compares two Characters numerically. @param anotherCharacter theClass Character, int compareTo(Object)Characterto be compared. @return the value0if the argument Character is equal to this Character; a value less than0if this Character is numerically less than the Character argument; and a value greater than0if this Character is numerically greater than the Character argument (unsigned comparison). Note that this is strictly a numerical comparison; it is not locale-dependent. @sinceJDK11.2
Compares this Character to another Object. If the Object is a Character this function behaves likeClass Character, byte COMBINING_SPACING_MARKcompareTo(Character). Otherwise it throws aClassCastException(as Characters are comparable only to other Characters). @param o theObjectto be compared. @return the value0if the argument is a Character numerically equal to this Character; a value less than0if the argument is a Character numerically greater than this Character; and a value greater than0if the argument is a Character numerically less than this Character. @exceptionClassCastExceptionif the argument is not aCharacter. @see java.lang.Comparable @sinceJDK11.2
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte CONNECTOR_PUNCTUATION
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte CONTROL
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte CURRENCY_SYMBOL
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte DASH_PUNCTUATION
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte DECIMAL_DIGIT_NUMBER
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte ENCLOSING_MARK
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte END_PUNCTUATION
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte FORMAT
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte LETTER_NUMBER
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte LINE_SEPARATOR
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte LOWERCASE_LETTER
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte MATH_SYMBOL
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte MODIFIER_LETTER
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte MODIFIER_SYMBOL
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte NON_SPACING_MARK
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte OTHER_LETTER
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte OTHER_NUMBER
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte OTHER_PUNCTUATION
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte OTHER_SYMBOL
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte PARAGRAPH_SEPARATOR
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte PRIVATE_USE
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte SPACE_SEPARATOR
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte START_PUNCTUATION
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte SURROGATE
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte TITLECASE_LETTER
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte UNASSIGNED
Public data for enumerated Unicode general category types. @since JDK1.1Class Character, byte UPPERCASE_LETTER
Public data for enumerated Unicode general category types. @since JDK1.1
Instances of the classClass Class, Class forName(String, boolean, ClassLoader)Classrepresent classes and interfaces in a running Java application. Every array also belongs to a class that is reflected as aClassobject that is shared by all arrays with the same element type and number of dimensions. The primitive Java types (booleanbytecharshortintlongfloatanddouble) and the keywordvoidare also represented asClassobjects.
Classhas no public constructor. InsteadClassobjects are constructed automatically by the Java Virtual Machine as classes are loaded and by calls to thedefineClassmethod in the class loader.The following example uses a
Classobject to print the class name of an object:
@author unascribed @version 1.void printClassName(Object obj) { System.out.println("The class of " + obj + " is " + obj.getClass().getName()); }100 04107 02/2202/9900 @see java.lang.ClassLoader#defineClass(byte[] int int) @since JDK1.0
Returns theClass Class, Class[] getClasses()Classobject 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 bygetName) 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 parameterloaderis null the class is loaded through the bootstrap class loader. The class is initialized only if theinitializeparameter istrueand if it has not been initialized earlier.If
namedenotes a primitive type or void an attempt will be made to locate a user-defined class in the unnamed package whose name isname. Therefore this method cannot be used to obtain any of theClassobjects representing primitive types or void.If
namedenotes an array class the component type of the array class is loaded but not initialized.For example in an instance method the expression:
is equivalent to:Class.forName("Foo")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.Class.forName("Foo" true this.getClass().getClassLoader())If the
loaderisnulland a security manager is present and the caller's class loader is not null then this method calls the security manager'scheckPermissionmethod with aRuntimePermission("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 @sinceJDK11.2
Returns an array containingClass Class, Class getComponentType()Classobjects representing all the public classes and interfaces that are members of the class represented by thisClassobject. This includes public class and interface members inherited from superclasses and public class and interface members declared by the class. This method returns an array of length 0 if thisClassobject has no public member classes or interfaces. This method also returns an array of length 0 if thisClassobject represents a primitive type an array class or void.For this class and each of its superclasses the following security checks are performed: If there is a security manager the security manager's
checkMemberAccessmethod is called withthisandMember.PUBLICas its arguments wherethisis this class or the superclass whose members are being determined. If the class is in a package then the security manager'scheckPackageAccessmethod is also called with the package name as its argument. Either of these calls could result in a SecurityException. @return the array ofClassobjects representing the public members of this class @exception SecurityException if access to the information is denied. @see SecurityManager#checkMemberAccess(Class int) @see SecurityManager#checkPackageAccess(String) @since JDK1.1
Returns theClass Class, Constructor getConstructor(Class[])Classrepresenting the component type of an array. If this class does not represent an array class this method returns null. @return theClassrepresenting the component type of this class if this class is an array @see java.lang.reflect.Array @since JDK1.1
Returns aClass Class, Constructor[] getConstructors()Constructorobject that reflects the specified public constructor of the class represented by thisClassobject. TheparameterTypesparameter is an array ofClassobjects that identify the constructor's formal parameter types in declared order.The constructor to reflect is the public constructor of the class represented by this
Classobject whose formal parameter types match those specified byparameterTypes.If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.PUBLICas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException. @param parameterTypes the parameter array @return theMethodobject of the public constructor that matches the specifiedparameterTypes@exception NoSuchMethodException if a matching method is not found. @exception SecurityException if access to the information is denied. @see java.lang.reflect.Constructor @see SecurityManager#checkMemberAccess(Class int) @see SecurityManager#checkPackageAccess(String) @since JDK1.1
Returns an array containingClass Class, Class[] getDeclaredClasses()Constructorobjects reflecting all the public constructors of the class represented by thisClassobject. An array of length 0 is returned if the class has no public constructors or if the class is an array class or if the class reflects a primitive type or void.If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.PUBLICas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException. @return the array containingMethodobjects for all the declared public constructors of this class matches the specifiedparameterTypes@exception SecurityException if access to the information is denied. @see java.lang.reflect.Constructor @see SecurityManager#checkMemberAccess(Class int) @see SecurityManager#checkPackageAccess(String) @since JDK1.1
Returns an array ofClass Class, Constructor getDeclaredConstructor(Class[])Classobjects reflecting all the classes and interfaces declared as members of the class represented by thisClassobject. This includes public protected default (package) access and private classes and interfaces declared by the class but excludes inherited classes and interfaces. This method returns an array of length 0 if the class declares no classes or interfaces as members or if thisClassobject represents a primitive type an array class or void.If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.DECLAREDas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException. @return the array ofClassobjects representing all the declared members of this class @exception SecurityException if access to the information is denied. @see SecurityManager#checkMemberAccess(Class int) @see SecurityManager#checkPackageAccess(String) @since JDK1.1
Returns aClass Class, Constructor[] getDeclaredConstructors()Constructorobject that reflects the specified constructor of the class or interface represented by thisClassobject. TheparameterTypesparameter is an array ofClassobjects that identify the constructor's formal parameter types in declared order.If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.DECLAREDas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException. @param parameterTypes the parameter array @return TheMethodobject for the constructor with the specified parameter list @exception NoSuchMethodException if a matching method is not found. @exception SecurityException if access to the information is denied. @see java.lang.reflect.Constructor @see SecurityManager#checkMemberAccess(Class int) @see SecurityManager#checkPackageAccess(String) @since JDK1.1
Returns an array ofClass Class, Field getDeclaredField(String)Constructorobjects reflecting all the constructors declared by the class represented by thisClassobject. These are public protected default (package) access and private constructors. The elements in the array returned are not sorted and are not in any particular order. If the class has a default constructor it is included in the returned array. This method returns an array of length 0 if thisClassobject represents an interface a primitive type an array class or void.See The Java Language Specification section 8.2.
If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.DECLAREDas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException. @return the array ofMethodobjects representing all the declared constructors of this class @exception SecurityException if access to the information is denied. @see java.lang.reflect.Constructor @see SecurityManager#checkMemberAccess(Class int) @see SecurityManager#checkPackageAccess(String) @since JDK1.1
Returns aClass Class, Field[] getDeclaredFields()Fieldobject that reflects the specified declared field of the class or interface represented by thisClassobject. Thenameparameter is aStringthat specifies the simple name of the desired field. Note that this method will not reflect thelengthfield of an array class.If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.DECLAREDas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException. @param name the name of the field @return theFieldobject for the specified field in this class @exception NoSuchFieldException if a field with the specified name is not found. @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
Returns an array ofClass Class, Method getDeclaredMethod(String, Class[])Fieldobjects reflecting all the fields declared by the class or interface represented by thisClassobject. This includes public protected default (package) access and private fields but excludes inherited fields. 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 declares no fields or if thisClassobject represents a primitive type an array class or void.See The Java Language Specification sections 8.2 and 8.3.
If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.DECLAREDas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException. @return the array ofFieldobjects representing all the declared fields of this class @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
Returns aClass Class, Method[] getDeclaredMethods()Methodobject that reflects the specified declared method of the class or interface represented by thisClassobject. Thenameparameter is aStringthat specifies the simple name of the desired method and theparameterTypesparameter is an array ofClassobjects 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>" aNoSuchMethodExceptionis raised.If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.DECLAREDas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod 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 theMethodobject 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
Returns an array ofClass Class, Class getDeclaringClass()Methodobjects reflecting all the methods declared by the class or interface represented by thisClassobject. This includes public protected default (package) access and private methods but excludes inherited methods. 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 declares no methods or if thisClassobject represents a primitive type an array class or void. 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 section 8.2.
If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.DECLAREDas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException. @return the array ofMethodobjects representing all the declared 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
If the class or interface represented by thisClass Class, Field getField(String)Classobject is a member of another class returns theClassobject representing the class in which it was declared. This method returns null if this class or interface is not a member of any other class. If thisClassobject represents an array class a primitive type or void then this method returns null. @return the declaring class for this class @since JDK1.1
Returns aClass Class, Field[] getFields()Fieldobject that reflects the specified public member field of the class or interface represented by thisClassobject. Thenameparameter is aStringspecifying the simple name of the desired field.If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.PUBLICas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException.The field to be reflected is determined by the algorithm that follows. Let C be the class represented by this object:
- If C declares a public field with the name specified that is the field to be reflected.
- If no field was found in step 1 above this algorithm is applied recursively to each direct superinterface of C. The direct superinterfaces are searched in the order they were declared.
- If no field was found in steps 1 and 2 above and C has a superclass S then this algorithm is invoked recursively upon S. If C has no superclass then a
NoSuchFieldExceptionis thrown.See The Java Language Specification sections 8.2 and 8.3. @param name the field name @return the
Fieldobject of this class specified byname@exception NoSuchFieldException if a field with the specified name is not found. @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
Returns an array containingClass Class, Method getMethod(String, Class[])Fieldobjects reflecting all the accessible public fields of the class or interface represented by thisClassobject. 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
Classobject represents a class this method returns the public fields of this class and of all its superclasses. If thisClassobject 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
checkMemberAccessmethod withthisandMember.PUBLICas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException.The implicit length field for array classs is not reflected by this method. User code should use the methods of class
Arrayto manipulate arrays.See The Java Language Specification sections 8.2 and 8.3. @return the array of
Fieldobjects 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
Returns aClass Class, Method[] getMethods()Methodobject that reflects the specified public member method of the class or interface represented by thisClassobject. Thenameparameter is aStringspecifying the simple name the desired method. TheparameterTypesparameter is an array ofClassobjects that identify the method's formal parameter types in declared order. IfparameterTypesisnullit is treated as if it were an empty array.If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.PUBLICas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod with the package name as its argument. Either of these calls could result in a SecurityException.If the
nameis "<init>"or "<clinit>" aNoSuchMethodExceptionis raised. Otherwise the method to be reflected is determined by the algorithm that follows. Let C be the class represented by this object: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.
- 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.
- 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.
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
Methodobject that matches the specifiednameandparameterTypes@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
Returns an array containingClass Class, int getModifiers()Methodobjects reflecting all the public member methods of the class or interface represented by thisClassobject 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 thisClassobject represents a class or interface that has no public member methods or if thisClassobject represents an array class primitive type or void.If there is a security manager this method first calls the security manager's
checkMemberAccessmethod withthisandMember.PUBLICas its arguments. If the class is in a package then this method also calls the security manager'scheckPackageAccessmethod 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
Methodobjects 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
Returns the Java language modifiers for this class or interface encoded in an integer. The modifiers consist of the Java Virtual Machine's constants forClass Class, ProtectionDomain getProtectionDomain()publicprotectedprivatefinalstaticabstractandinterface; they should be decoded using the methods of classModifier.If the underlying class is an array class then its
publicprivateandprotectedmodifiers are the same as those of its component type. If thisClassrepresents a primitive type or void itspublicmodifier is alwaystrueand itsprotectedandprivatemodifers are alwaysfalse. If this object represents an array class a primitive type or void then itsfinalmodifier is alwaystrueand its interface modifer is alwaysfalse. 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
intrepresenting the modifiers for this class @see java.lang.reflect.Modifier @since JDK1.1
Returns theClass Class, boolean isAssignableFrom(Class)ProtectionDomainof this class. If there is a security manager installed this method first calls the security manager'scheckPermissionmethod with aRuntimePermission("getProtectionDomain")permission to ensure it's ok to get theProtectionDomain. @return the ProtectionDomain of this class @throws SecurityException if a security manager exists and itscheckPermissionmethod doesn't allow geting the ProtectionDomain. @see java.security.ProtectionDomain @see SecurityManager#checkPermission @see java.lang.RuntimePermission @sinceJDK11.2
Determines if the class or interface represented by thisClass Class, boolean isInstance(Object)Classobject is either the same as or is a superclass or superinterface of the class or interface represented by the specifiedClassparameter. It returnstrueif so; otherwise it returnsfalse. If thisClassobject represents a primitive type this method returnstrueif the specifiedClassparameter is exactly thisClassobject; otherwise it returnsfalse.Specifically this method tests whether the type represented by the specified
Classparameter can be converted to the type represented by thisClassobject via an identity conversion or via a widening reference conversion. See The Java Language Specification sections 5.1.1 and 5.1.4 for details. @param cls theClassobject to be checked @return thebooleanvalue indicating whether objects of the typeclscan be assigned to objects of this class @exception NullPointerException if the specified Class parameter is null. @since JDK1.1
Determines if the specifiedClass Class, boolean isPrimitive()Objectis assignment-compatible with the object represented by thisClass. This method is the dynamic equivalent of the Java languageinstanceofoperator. The method returnstrueif the specifiedObjectargument is non-null and can be cast to the reference type represented by thisClassobject without raising aClassCastException.It returnsfalseotherwise.Specifically if this
Classobject represents a declared class this method returnstrueif the specifiedObjectargument is an instance of the represented class (or of any of its subclasses); it returnsfalseotherwise. If thisClassobject represents an array class this method returnstrueif the specifiedObjectargument can be converted to an object of the array class by an identity conversion or by a widening reference conversion; it returnsfalseotherwise. If thisClassobject represents an interface this method returnstrueif the class or any superclass of the specifiedObjectargument implements this interface; it returnsfalseotherwise. If thisClassobject represents a primitive type this method returnsfalse. @param obj the object to check @return true ifobjis an instance of this class @since JDK1.1
Determines if the specifiedClassobject represents a primitive type.There are nine predefined
Classobjects to represent the eight primitive types and void. These are created by the Java Virtual Machine and have the same names as the primitive types that they represent namelybooleanbytecharshortintlongfloatanddouble.These objects may only be accessed via the following public static final variables and are the only
Classobjects for which this method returnstrue. @return true if and only if this class represents a primitive type @see java.lang.Boolean#TYPE @see java.lang.Character#TYPE @see java.lang.Byte#TYPE @see java.lang.Short#TYPE @see java.lang.Integer#TYPE @see java.lang.Long#TYPE @see java.lang.Float#TYPE @see java.lang.Double#TYPE @see java.lang.Void#TYPE @since JDK1.1
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 aClassCastException:@author unascribed @version 1.Object x = new Integer(0); System.out.println((String)x);15 0917 02/2102/9800 @since JDK1.0
Thrown when a circularity has been detected while initializing a class. @author unascribed @version 1.10 0912 02/2102/9800 @since JDK1.0
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.15 0917 02/2102/9800 @since JDK1.0
The classClass ClassLoader, constructor ClassLoader(ClassLoader)ClassLoaderis an abstract class. A class loader is an object that is responsible for loading classes. Given the name of a class it 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
Classobject contains a reference to theClassLoaderthat 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
ClassLoaderin 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
ClassLoaderclass uses a delegation model to search for classes and resources. Each instance ofClassLoaderhas an associated parent class loader. When called upon to find a class or resource aClassLoaderinstance 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 aClassLoaderinstance.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
CLASSPATHenvironment 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
defineClassconverts an array of bytes into an instance of classClass. Instances of this newly defined class can be created using thenewInstancemethod in classClass.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
loadClassmethod 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
findClassandloadClassDatato load a class from the network. Once it has downloaded the bytes that make up the class it should use the methoddefineClassto 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.129 05142 02/1917/00 @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
Creates a new class loader using the specified parent class loader for delegation.Class ClassLoader, Class defineClass(String, byte[], int, int, ProtectionDomain)If there is a security manager its
checkCreateClassLoadermethod is called. This may result in a security exception. @throws SecurityException if a security manager exists and itscheckCreateClassLoadermethod doesn't allow creation of a new class loader. @param parent the parent class loader @see java.lang.SecurityException @see java.lang.SecurityManager#checkCreateClassLoader() @sinceJDK11.2
Converts an array of bytes into an instance of class Class with an optional ProtectionDomain. If the domain isClass ClassLoader, Package definePackage(String, String, String, String, String, String, String, URL)nullthen 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
CodeSourcewithin theProtectionDomainof the class. Any classes added to that package must contain the same set of certificates or aSecurityExceptionwill be thrown. Note that if thenameargument 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 if the data did not contain a valid class @exception IndexOutOfBoundsException if either
offorlenis negative or ifoff+lenis greater thanb.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 certificatesthenthan this class or if the class name begins with "java.". @param name the name of the class @param b the class bytes @param off the start offset of the class bytes @param len the length of the class bytes @param protectionDomain the ProtectionDomain of the class @return theClassobject created from the data and optional ProtectionDomain.
Defines a package by name in this ClassLoader. This allows class loaders to define the packages for their classes. Packages must be created before the class is defined and package names must be unique within a class loader and cannot be redefined or changed once created. @param name the package name @param specTitle the specification title @param specVersion the specification version @param specVendor the specification vendor @param implTitle the implementation title @param implVersion the implementation version @param implVendor the implementation vendor @param sealBase If not null then this package is sealed with respect to the given code source URL. Otherwise the package is not sealed. @return the newly definedClass ClassLoader, Class findClass(String)Packageobject @exception IllegalArgumentException if package name duplicates an existing package either in this class loader or one of its ancestors @sinceJDK11.2
Finds the specified class. This method should be overridden by class loader implementations that follow the new delegation model for loading classes and will be called by theClass ClassLoader, String findLibrary(String)loadClassmethod after checking the parent class loader for the requested class. The default implementation throwsClassNotFoundException. @param name the name of the class @return the resultingClassobject @exception ClassNotFoundException if the class could not be found @sinceJDK11.2
Returns the absolute path name of a native library. The VM invokes this method to locate the native libraries that belong to classes loaded with this class loader. If this method returnsClass ClassLoader, URL findResource(String)nullthe VM searches the library along the path specified as thejava.library.pathproperty. @param libname the library name @return the absolute path of the native library @see java.lang.System#loadLibrary(java.lang.String) @see java.lang.System#mapLibraryName(java.lang.String) @sinceJDK11.2
Finds the resource with the given name. Class loader implementations should override this method to specify where to find resources. @param name the resource name @return a URL for reading the resource orClass ClassLoader, Enumeration findResources(String)nullif the resource could not be found @sinceJDK11.2
Returns an Enumeration of URLs representing all the resources with the given name. Class loader implementations should override this method to specify where to load resources from. @param name the resource name @return an Enumeration of URLs for the resources @throws IOException if I/O errors occur @sinceClass ClassLoader, Class findSystemClass(String)JDK11.2
Finds a class with the specified name loading it if necessary.Class ClassLoader, Package getPackage(String)Prior to
JDK1.the Java 2 SDK this method loads a class from the local file system in a platform-dependent manner and returns a class object that has no associated class loader.Since
JDK1the Java 2 SDK v1.2 this method loads the class through the system class loader(see Clas objects returned might haveClassLoaders associated with them. Subclasses ofClassLoaderneed not usually call this method because most class loaders need to override just @separa#ClassLoader(ClassLoader) @see #getParent() @paramname the name of the class that is to be found @returnathesystemClassclass withobject for thegivenspecifiedname@exception ClassNotFoundException if the class could not be found @see #ClassLoader(ClassLoader) @see #getParent()
Returns a Package that has been defined by this class loader or any of its ancestors. @param name the package name @return the Package corresponding to the given name or null if not found @sinceClass ClassLoader, Package[] getPackages()JDK11.2
Returns all of the Packages defined by this class loader and its ancestors. @return the array ofClass ClassLoader, ClassLoader getParent()Packageobjects defined by thisClassLoader@sinceJDK11.2
Returns the parent class loader for delegation. Some implementations may useClass ClassLoader, Enumeration getResources(String)nullto represent the bootstrap class loader. This method will returnnullin such implementations if this class loader's parent is the bootstrap class loader.If a security manager is present and the caller's class loader is not null and is not an ancestor of this class loader then this method calls the security manager's
checkPermissionmethod with aRuntimePermission("getClassLoader")permission to ensure it's ok to access the parent class loader. If not aSecurityExceptionwill be thrown. @return the parentClassLoader@throws SecurityException if a security manager exists and itscheckPermissionmethod doesn't allow access to this class loader's parent class loader. @see SecurityManager#checkPermission @see java.lang.RuntimePermission @sinceJDK11.2
Finds all the resources with the given name. A resource is some data (images audio text etc) that can be accessed by class code in a way that is independent of the location of the code.Class ClassLoader, ClassLoader getSystemClassLoader()The name of a resource is a "/"-separated path name that identifies the resource.
The search order is described in the documentation for @para name resource name @return an enumeration of URL to the resource. If no resources could be found the enumeration will be empty. Resources that the doesn't have access to will not be in the enumeration. @throws IOException if I/O errors occur @since
JDK11.2 @see #getResource @see #findResources
Returns the system class loader for delegation. This is the default delegation parent for newClass ClassLoader, URL getSystemResource(String)ClassLoaderinstances and is typically the class loader used to start the application.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
checkPermissionmethod with aRuntimePermission("getClassLoader")permission to ensure it's ok to access the system class loader. If not aSecurityExceptionwill be thrown. @return the systemClassLoaderfor delegation ornullif none @throws SecurityException if a security manager exists and itscheckPermissionmethod doesn't allow access to the system class loader. @see SecurityManager#checkPermission @see java.lang.RuntimePermission @sinceJDK11.2
Find a resource of the specified name from the search path used to load classes.Class ClassLoader, Enumeration getSystemResources(String)In JDK1.1 the search path used is that of the virtual machine's built-in class loader.
Since
JDK1the Java 2 SDK v1.2 this method locates the resource through the system class loader (see @para name the resource name @return a URL for reading the resource ornullif the resource could not be found @since JDK1.1
Finds all resources of the specified name from the search path used to load classes. The resources thus found are returned as anClass ClassLoader, Class loadClass(String, boolean)EnumerationofURLobjects.The search order is described in the documentation for #getSystemResource(String)
@param name the resource name @return an enumeration of resource URLs @throws IOException if I/O errors occur @since
JDK11.2
Loads the class with the specified name. The default implementation of this method searches for classes in the following order:
If the class was found using the above steps and the
- Call #findLoadedClass(String) to check if the class has already been loaded.
- Call the
loadClassmethod on the parent class loader. If the parent isnullthe class loader built-in to the virtual machine is used instead.
- Call the #findClass(String) method to find the class.
resolveflag is true this method will then call the #resolveClass(Class) method on the resulting class object.From
JDK1the Java 2 SDK v1.2 subclasses of ClassLoader are encouraged to override #findClass(String) rather than this method.@param name the name of the class @param resolve if
truethen resolve the class @return the resultingClassobject @exception ClassNotFoundException if the class could not be found
Thrown when an application tries to load in a class through its string name using:Class ClassNotFoundException, constructor ClassNotFoundException(String, Throwable)
- The
forNamemethod in classClass.- The
findSystemClassmethod in classClassLoader.- The
loadClassmethod in classClassLoader.but no definition for the class with the specifed name could be found. @author unascribed @version 1.
8 0513 02/0402/9800 @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
Constructs aClass ClassNotFoundException, Throwable getException()ClassNotFoundExceptionwith the specified detail message and optional exception that was raised while loading the class. @param s the detail message @param ex the exception that was raised while loading the class @sinceJDK11.2
Returns the exception that was raised if an error occurred while attempting to load the class. Otherwise returns null. @return theExceptionthat was raised while loading a class @sinceJDK11.2
Thrown to indicate that theclonemethod in classObjecthas been called to clone an object but that the object's class does not implement theCloneableinterface.Applications that override the
clonemethod can also throw this exception to indicate that an object could not or should not be cloned. @author unascribed @version 1.6 098 02/2102/9800 @see java.lang.Cloneable @see java.lang.Object#clone() @since JDK1.0
A class implements theCloneableinterface 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.Attempts to clone instances that do not implement the
Cloneableinterface result in the exceptionCloneNotSupportedExceptionbeing thrown.The interface Cloneable declares no methods. @author unascribed @version 1.
8 0910 02/2102/9800 @see java.lang.CloneNotSupportedException @since JDK1.0
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's natural ordering 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.
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 operation.
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 BigDecimals 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.9 0913 02/3002/9800 @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 @sinceJDK11.2
TheCompilerclass is provided to support Java-to-native-code compilers and related services. By design theCompilerclass 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.compilerexists. (System properties are accessible throughgetPropertyand a method defined by theSystemclass.) If so it is assumed to be the name of a library (with a platform-dependent exact location and type); theloadLibrarymethod in classSystemis called to load that library. If this loading succeeds the function namedjava_lang_Compiler_start()in that library is called.If no compiler is available these methods do nothing. @author Frank Yellin @version 1.
12 0615 02/2902/9800 @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
The Double class wraps a value of the primitive typeClass Double, int compareTo(Double)doublein an object. An object of typeDoublecontains a single field whose type isdouble.In addition this class provides several methods for converting a
doubleto aStringand aStringto adoubleas well as other constants and methods useful when dealing with adouble. @author Lee Boynton @author Arthur van Hoff @version 1.54 0963 02/1102/9800 @since JDK1.0
Compares two Doubles numerically. There are two ways in which comparisons performed by this method differ from those performed by the Java language numerical comparison operators (Class Double, int compareTo(Object)< <= == >= >) when applied to primitive doubles:This ensures that Double.compareTo(Object) (which inherits its behavior from this method) obeys the general contract for Comparable.compareTo and that the natural order on Doubles is total. @param anotherDouble the
Double.NaNis considered by this method to be equal to itself and greater than all other double values (includingDouble.POSITIVE_INFINITY).0.0dis considered by this method to be greater than-0.0d.Doubleto be compared. @return the value0ifanotherDoubleis numerically equal to this Double; a value less than0if this Double is numerically less thananotherDouble; and a value greater than0if this Double is numerically greater thananotherDouble. @sinceJDK11.2 @see Comparable#compareTo(Object)
Compares this Double to another Object. If the Object is a Double this function behaves likeClass Double, int hashCode()compareTo(Double). Otherwise it throws aClassCastException(as Doubles are comparable only to other Doubles). @param o theObjectto be compared. @return the value0if the argument is a Double numerically equal to this Double; a value less than0if the argument is a Double numerically greater than this Double; and a value greater than0if the argument is a Double numerically less than this Double. @exceptionClassCastExceptionif the argument is not aDouble. @see java.lang.Comparable @sinceJDK11.2
Returns a hashcode for thisClass Double, double longBitsToDouble(long)Doubleobject. 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 primitivedoublevalue represented by thisDoubleobject. That is the hashcode is the value of the expression:where(int)(v^(v>>>32))vis defined by:@return along v = Double.doubleToLongBits(this.longValuedoubleValue());hash codevalue for this object.
Returns the double-float 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 "double precision" bit layout. That floating-point value is returned as the result.Class Double, double parseDouble(String)If the argument is
0x7ff0000000000000Lthe result is positive infinity.If the argument is
0xfff0000000000000Lthe result is negative infinity.If the argument is any value in the range
0x7ff0000000000001Lthrough0x7fffffffffffffffLor in the range0xfff0000000000001Lthrough0xffffffffffffffffLthe result is NaN. All IEEE 754 NaN values of typedoubleare in effect lumped together by the Java programming language into a single value called NaN. Distinct values of NaN are only accessible by use of theDouble.doubleToRawLongBitsmethod.In all other cases let s e and m be three values that can be computed from the argument:
Then the floating-point result equals the value of the mathematical expression s·m·2e-1075. @param bits anyint s = ((bits >> 63) == 0) 1 : -1; int e = (int)((bits >> 52) & 0x7ffL); long m = (e == 0) (bits & 0xfffffffffffffL) < 1 : (bits & 0xfffffffffffffL) | 0x10000000000000L;longinteger. @return thedoublefloating-point value with the same bit pattern.
Returns a new double initialized to the value represented by the specifiedClass Double, String toString(double)Stringas performed by thevalueOfmethod of classDouble. @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) @sinceJDK11.2
Creates a string representation of thedoubleargument. All characters mentioned below are ASCII characters.
- If the argument is NaN the result is the string "NaN".
- Otherwise the result is a string that represents the sign and magnitude (absolute value) of the argument. If the sign is negative the first character of the result is '
-' ('-'); if the sign is positive no sign character appears in the result. As for the magnitude m:- If m is infinity it is represented by the characters
"Infinity"; thus positive infinity produces the result"Infinity"and negative infinity produces the result"-Infinity".- If m is zero it is represented by the characters
"0.0"; thus negative zero produces the result"-0.0"and positive zero produces the result"0.0".- If m is greater than or equal to 10-3 but less than 107 then it is represented as the integer part of m in decimal form with no leading zeroes followed by
'.'(.) followed by one or more decimal digits representing the fractional part of m.- If m is less than 10-3 or not less than 107 then it is represented in so-called "computerized scientific notation." Let n be the unique integer such that 10n<=m<10n+1; then let a be the mathematically exact quotient of m and 10n so that 1<=a<10. The magnitude is then represented as the integer part of a as a single decimal digit followed by
'.'(.) followed by decimal digits representing the fractional part of a followed by the letter'E'(E) followed by a representation of n as a decimal integer as produced by the method Integer#toString(int)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 thedoublevalue nearest to x; or if twodoublevalues are equally close to x then d must be one of them and the least significant bit of the significand of d must be0. @param d thedoubleto be converted. @return a string representation of the argument.
AnErroris a subclass ofThrowablethat indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. TheThreadDeatherror though a "normal" condition is also a subclass ofErrorbecause most applications should not try to catch it.A method is not required to declare in its
throwsclause any subclasses ofErrorthat 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.10 0912 02/2102/9800 @see java.lang.ThreadDeath @since JDK1.0
The classExceptionand its subclasses are a form ofThrowablethat indicates conditions that a reasonable application might want to catch. @author Frank Yellin @version 1.25 0927 02/2102/9800 @see java.lang.Error @since JDK1.0
Signals that an unexpected exception has occurred in a static initializer. AnExceptionInInitializerErroris thrown to indicate that an exception occurred during evaluation of a static initializer or the initializer for a static variable. @author Frank Yellin @version 1.9 0811 02/2502/9800 @since JDK1.1
The Float class wraps a value of primitive typeClass Float, int compareTo(Float)floatin an object. An object of typeFloatcontains a single field whose type isfloat.In addition this class provides several methods for converting a
floatto aStringand aStringto afloatas well as other constants and methods useful when dealing with afloat. @author Lee Boynton @author Arthur van Hoff @version 1.48 0760 02/2302/9800 @since JDK1.0
Compares two Floats numerically. There are two ways in which comparisons performed by this method differ from those performed by the Java language numerical comparison operators (Class Float, int compareTo(Object)< <= == >= >) when applied to primitive floats:This ensures that Float.compareTo(Object) (which inherits its behavior from this method) obeys the general contract for Comparable.compareTo and that the natural order on Floats is total. @param anotherFloat the
Float.NaNis considered by this method to be equal to itself and greater than all other float values (includingFloat.POSITIVE_INFINITY).0.0fis considered by this method to be greater than-0.0f.Floatto be compared. @return the value0ifanotherFloatis numerically equal to this Float; a value less than0if this Float is numerically less thananotherFloat; and a value greater than0if this Float is numerically greater thananotherFloat. @sinceJDK11.2 @see Comparable#compareTo(Object)
Compares this Float to another Object. If the Object is a Float this function behaves likeClass Float, boolean equals(Object)compareTo(Float). Otherwise it throws aClassCastException(as Floats are comparable only to other Floats). @param o theObjectto be compared. @return the value0if the argument is a Float numerically equal to this Float; a value less than0if the argument is a Float numerically greater than this Float; and a value greater than0if the argument is a Float numerically less than this Float. @exceptionClassCastExceptionif the argument is not aFloat. @see java.lang.Comparable @sinceJDK11.2
Compares this object against some other object. The result isClass Float, float intBitsToFloat(int)trueif and only if the argument is notnulland is aFloatobject that represents afloatthat has the identical bit pattern to the bit pattern of thefloatrepresented 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 same int value when applied to each.Note that in most cases for two instances of class
Floatf1andf2the value off1.equals(f2)istrueif and only iff1.floatValue() == f2.floatValue()also has the value
true. However there are two exceptions:This definition allows hashtables to operate properly. @param obj the object to be compared @return
- If
f1andf2both representFloat.NaNthen theequalsmethod returnstrueeven thoughFloat.NaN==Float.NaNhas the valuefalse.- If
f1represents+0.0fwhilef2represents-0.0for vice versa theequaltest has the valuefalseeven though0.0f==-0.0fhas the valuetrue.trueif the objects are the same;falseotherwise. @see java.lang.Float#floatToIntBits(float)
Returns the single-float 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 precision" bit layout.Class Float, float parseFloat(String)If the argument is
0x7f800000the result is positive infinity.If the argument is
0xff800000the result is negative infinity.If the argument is any value in the range
0x7f800001through0x7fffffffor in the range0xff800001through0xffffffffthe result is NaN. All IEEE 754 NaN values of typefloatare in effect lumped together by the Java programming language into a singlefloatvalue called NaN. Distinct values of NaN are only accessible by use of theFloat.floatToRawIntBitsmethod.In all other cases let s e and m be three values that can be computed from the argument:
Then the floating-point result equals the value of the mathematical expression s·m·2e-150. @param bits an integer. @return the single-format floating-point value with the same bit pattern.int s = ((bits >> 31) == 0) 1 : -1; int e = ((bits >> 23) & 0xff); int m = (e == 0) (bits & 0x7fffff) < 1 : (bits & 0x7fffff) | 0x800000;
Returns a new float initialized to the value represented by the specifiedStringas performed by thevalueOfmethod of classDouble. @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.Double#valueOf(String) @sinceJDK11.2
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.
11 0913 02/2102/9800 @since JDK1.0
Thrown when an application tries to load in a classthrough its string name using: The forName method in class Class. The findSystemClass method in class ClassLoader. The loadClass method in class ClassLoader.but the currently executing method does not have access to the definition of the specified class because the class is not public and in another package.An instance of this class can also be thrown when an application tries to create an instance of a class using the
newInstancemethod in classClassbut the current method does not have access to the appropriate zero-argument constructor. @author unascribed @version 1.6 099 02/2102/9800 @see java.lang.Class#forName(java.lang.String) @see java.lang.Class#newInstance() @see java.lang.ClassLoader#findSystemClass(java.lang.String) @see java.lang.ClassLoader#loadClass(java.lang.String boolean) @since JDK1.0
Thrown to indicate that a method has been passed an illegal or inappropriate argument. @author unascribed @version 1.15 0917 02/2102/9800 @see java.lang.Thread#setPriority(int) @since JDK1.0
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.7 099 02/2102/9800 @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
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.7 099 02/2102/9800 @since JDK1.1
Thrown to indicate that a thread is not in an appropriate state for the requested operation. See for example thesuspendandresumemethods in classThread. @author unascribed @version 1.16 0918 02/2102/9800 @see java.lang.Thread#resume() @see java.lang.Thread#suspend() @since JDK1.0