Instance refers to the object implementation based on a certain class. This process is called instantiation.
Instance generation:
1. Use the new keyword (a construction method that requires public modification. The default no-parameter construction will be overwritten and hidden. You need to pay attention when using the framework. You can also pass Control the access modifier of the constructor and implement the singleton mode - lazy man | hungry man (double check lock) | static inner class | enumeration -.)
2. The newInstance method of the Class class.
3. The newInstance method of the Constructor class
4. Clone (implementing the Cloneable interface)
Serialization and deserialization (implementing Serializable or Externalizable)
For more java knowledge, please pay attention to the java basic tutorial column.
The above is the detailed content of What does instance mean in java?. For more information, please follow other related articles on the PHP Chinese website!