Javaoo encapsulation, inheritance, abstract summary

Source: Internet
Author: User
Tags modifiers naming convention

Javaoo
Packaging
The composition of the class
Property
Method
The hiding of information
Four access modifiers
Private
Private permissions, which are accessible only in this class
Default
Default permissions, accessible only in the same package class
Protected
Protected permissions can only be accessed in the same package class or subclass of a different package class
Public
Public permissions, accessible from all locations
Implementation of the method
Must have a public non-parametric construct
Must have a private property provided by the Get/set method that conforms to the naming convention
Inherited
Must be a relationship
Inheritance in keyword Extands,java is a single-inheritance structure
One subclass has and only one parent class
Construction methods are not inherited
In the Java bottom, is the memory overlay method implementation
Subclass Object = Parent Class object Part + Subclass Object part
ToString: Returns a description of an object string. The output is: class name @ Reference address
equals: Determines whether the two objects are business equal (overriding method)
Finalize: Destroys the object, which is called by the GC (garbage collector), and can be called but not rewritten by the programmer. He's a protected method in Java.
Object
Is the final class of all classes (parent class)
Abstract
Abstract class
There is no abstract method in the syntax that allows abstract classes, but it loses its abstract meaning.
Will constantly extract the parent class to a certain level
Abstract methods
Abstract methods must be in an abstract class
The abstract method that the parent class writes, the subclass must all implement
Abstract method in parent class, only signature, no method body
Final
The final class is not inherited by the final class.
Final method cannot be overridden by final modification of the method as the final method
Final modified variables and properties are called constants, and data cannot be changed
Packaging
The composition of the class
Property
Method
The hiding of information
Four access modifiers
Private
Private permissions, which are accessible only in this class
Default
Default permissions, accessible only in the same package class
Protected
Protected permissions can only be accessed in the same package class or subclass of a different package class
Public
Public permissions, accessible from all locations
Implementation of the method
Must have a public non-parametric construct
Must have a private property provided by the Get/set method that conforms to the naming convention
Inherited
Must be a relationship
Inheritance in keyword Extands,java is a single-inheritance structure
One subclass has and only one parent class
Construction methods are not inherited
In the Java bottom, is the memory overlay method implementation
Subclass Object = Parent Class object Part + Subclass Object part
ToString: Returns a description of an object string. The output is: class name @ Reference address
equals: Determines whether the two objects are business equal (overriding method)
Finalize: Destroys the object, which is called by the GC (garbage collector), and can be called but not rewritten by the programmer. He's a protected method in Java.
Object
Is the final class of all classes (parent class)
Abstract
Abstract class
There is no abstract method in the syntax that allows abstract classes, but it loses its abstract meaning.
Will constantly extract the parent class to a certain level
Abstract methods
Abstract methods must be in an abstract class
The abstract method that the parent class writes, the subclass must all implement
Abstract method in parent class, only signature, no method body
Final
The final class is not inherited by the final class.
Final method cannot be overridden by final modification of the method as the final method
Final modified variables and properties are called constants, and data cannot be changed

Javaoo encapsulation, inheritance, abstract summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.