4.1 Object-oriented basic 4.1.2 Object-oriented features 1. Encapsulation 2. Inheritance 3. Polymorphism 4.2 The definition of class for Java class and object 4.2.1 class includes the definition of class declaration and class body; 1. class declaration [PU blic][abstract | final]class classname[extends superclass][implements interfacenamelist]{//Member variable declaration Member method declaration} Abstract class cannot be instantiated, final end class cannot be inherited; 4.2.2 object using Reference Object name _ object name 4.2.3 UML diagram representation class
Class name |
List of member variables |
Method List |
4.2.4 Understanding stacks and heaps
When the Java program runs, the JVM needs to allocate memory to the data. The memory space is logically divided into two structures: stack and heap. When the Java program runs, the called method parameters and local variables defined in the method are stored in the memory stack, and when the program runs new to create the object, the JVM allocates memory in the heap.
Java Private Learning Notes--4th class and Object basics