Basic knowledge of Java 1

How to get the Class object
1. Call the getClass() method of the Object class to get the Class object.
example:

 MyObject x;
   Class c1=x.getClass();

2, Use the static method forName() in the Class class to obtain the Class object corresponding to the string.

  Class c2=Class.forName("Myobject");

3. The third method to get the Class type object, if T is a Java type, then T.class represents
a matching class object.

Class l1=int.class;

Overloading
method overloading: more than one method with the same name is allowed in the same class, as long as their
number of parameters or value types are different. In this case, the method is called overloaded and
cannot be passed. The return value of the method is used to distinguish the method, that is, there cannot be two methods with the same method name,
and the number of parameters and sequence types are the same

Guess you like

Origin blog.csdn.net/qq_41827511/article/details/113341330