Java is a pure object-oriented language developed by the C + + language , and its basic elements include simple data types and composite data types (i.e., classes). Class is an abstract description of objective things, it has four object-oriented characteristics, namely: encapsulation, inheritance, polymorphism and communication correlation.
classes are made up of properties and methods , and classes, properties, and methods are limited by the use of modifiers. Common modifiers include: public, protected, private, static, final, abstract, and so on. In addition to classes, there are abstract classes and interfaces in the Java language, where abstract classes are classes that use the abstract modifier, which contains abstractions (that is, only the declaration of methods, no method body, and the abstract method needs to be overridden by its subclasses), and the key of the interface is interface. It contains only member variables and abstract methods that are decorated with finall. The relationship between classes is inheritance (extends), the relationship between interfaces is also inheritance (extends), and the relationship between classes and interfaces is implementation (implements).
There are three types of methods in a class, namely, the construction method, the common method, and the main method. The constructor method is the way the object is initialized, and there are generally multiple construction methods that construct different objects based on the parameters that are brought in. The Main method is the entry for the program, in the fixed format: public static void Main (String [] args). The methods in the class are polymorphic, namely: overloading and overwriting. Where overloads are methods with the same name in the same class, with different types and numbers of arguments, overrides are methods with the same name between the parent and child classes that have an inheritance relationship, and the type and number of parameters and the return values are the same.
When you use a class to declare an object, you are creating a different entity, that is, instantiating it. And you need to use the new operator to request memory space. When the object is no longer needed, Java has three garbage collection methods: The JVM recycles automatically, calls the System.GC () method, and defines the Finalize () destructor method.