Class is what's the use , why you want to use in the Class Yeah !
The question mark What does it mean ?
Thank you out!
------ Solution ---------------------------------------- ----
some containers can put any object , such as List, but then take the time to do type conversion. If in a statement when the specified type , then do not need to take the time to do the type of strong turn .
List
------ Solution ---------------- ----------------------------
recommend you look at the generic
------ Solution --- -----------------------------------------
generic parameter types are also can be wildcard type .
such Class classType = Class.forName ("java.lang.String") ;
"?" on behalf of an unknown type
------ Solution ------------------------------ --------------
public final class Class
Class no public constructor. Class objects are loaded at the time by the Java Virtual Machine and class by calling the class loader defineClass method of automatically constructed .
The following example uses a Class object to display the object's class name:
void printClassName (Object obj) {
System.out.println ("The class of" + obj +
"is" + obj.getClass () getName ()).;
}
You can also use a class literal (JLS Section 15.8.2) to obtain the specified type ( or void) the Class object. For example:
System.out.println ("The name of class Foo is:" + Foo.class.getName ());
------ Solution ------------------------------------ --------
java.lang
class Class
java.lang.Object
java.lang.Class
type parameter :
T - Class object modeling by this type of class. For example , String.class type is Class
------ Solution ------------------------------------ --------
Class class is generally used for reflection , < > indicates a generic ? wildcard
------ Solution ---------- ----------------------------------
upstairs said it right !
------ For reference only -------------------------------------- -
generic , which means that a certain type of Object.
------ For reference only -------------------------------------- -
Yes, that is right upstairs right
没有评论:
发表评论