![]() ![]() loader - class loader from which the class must be loaded Returns: class object representing the desired class Throws: LinkageError - if the linkage fails ExceptionInInitializerError - if the initialization provokedīy this method fails ClassNotFoundException - if the class cannot be located by See Section 12.4 of The Java Language Specification. Parameters: name - fully qualified name of the desired class initialize - if true the class will be initialized. Note that this method does not check whether the requested class Initializing as specified in Sections 12.2, 12.3 and 12.4 of The Note that this method throws errors related to loading, linking or The array class is loaded but not initialized.įor example, in an instance method the expression:Ĭlass.forName("Foo", true, this.getClass().getClassLoader()) If name denotes an array class, the component type of Obtain any of the Class objects representing primitive Will be made to locate a user-defined class in the unnamed package whose If name denotes a primitive type or void, an attempt Initialize parameter is true and if it has Loader is null, the class is loaded through the bootstrapĬlass loader. Loader is used to load the class or interface. Locate, load, and link the class or interface. Given the fully qualified name for a class or interface (in the sameįormat returned by getName) this method attempts to Interface with the given string name, using the given class loader. Returns the Class object associated with the class or forName public static Class forName( String className).Information about modifiers and type parameters Since: 1.8 Returns: a string describing this Class, including Originating source code or illegal on the originating sourceĬode may be present. ![]() Of a type is being generated, modifiers not present on the Note that since information about the runtime representation characters, one set of brackets per dimension of Type's type parameters, if any, followed by a sequence of If there are no type parameters, theįor an array type, the string starts with the type name,įollowed by an angle-bracketed comma-separated list of the Separate any modifiers from the kind of type. The string is formatted as a list of type modifiers, if any,įollowed by the kind of type (empty string for primitive typesĪnd class, enum, interface, interface, as appropriate), followedīy the type's name, followed by an angle-bracketedĬomma-separated list of the type's type parameters, if any.Ī space is used to separate modifiers from one another and to Information about modifiers and type parameters. Returns a string describing this Class, including ![]() ("The name of class Foo is: "+()) Since: 1.0 See Also: fineClass(byte, int, int), Type (or for void) using a class literal. It is also possible to get the Class object for a named The following example uses a Class object to print the Other members are the classes and interfaces whose declarations areĮnclosed within the top-level class declaration. Will typically record a top-level class as the host of a nest where the The classes and interfaces which belong to a nest, including its host, areĬlass files are generated, for example, a Java compiler Nest host, and enumerates the other nestmates whichīelong to the nest each of them in turn records it as the nest host. The classes and interfaces are known as nestmates. A nest is a set ofĬlasses and interfaces, in the same run-time package, thatĪllow mutual access to their private members. Other methods describe how a class or interface Some methods of class Class expose whether the declaration ofĪ class or interface in Java source code was enclosed withinĪnother declaration. Such as the module returned by getModule(). A fewĬharacteristics are determined by the class loading environment at run time, Most characteristics are derived from the classįile that the class loader passed to the Java Virtual Machine. The methods of class Class expose many characteristics of aĬlass or interface. Object is constructed automatically by the Java Virtual Machine The primitive Java types ( boolean,Ĭlass has no public constructor. That is shared by all arrays with the same element type and number Every array alsoīelongs to a class that is reflected as a Class object An enum type is a kind of class and anĪnnotation type is a kind of interface. Instances of the class Class represent classes and interfaces ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |