Java Object-oriented review

Source: Internet
Author: User

Java Object-oriented review1. The class is abstract and the object is specific 2. Method overloading: Condition: (1): In the same Class (2): Method name is the same (3): Method parameter is different 3. Construction Method: Syntax : (1) must be the same as the class name (2) must have no return type, can be overloaded (3) If you do not have a custom constructor, the system will automatically create an parameterless construction method (4) If you have customized a constructor method, the system will not Creates this parameterless constructor function: (1) Initializes a member variable (2) in the class to accomplish some of the necessary initialization work 4.this is equivalent to the current object, which can be omitted in general 5. Scope: Scope of the class: Publ IC Private (internal class) scope of the default member variable: Public private protected Defaultpublic: Publicly owned protected: protected private: Private de Fault: The default
tr>
public
protected
private Only you can access
default
6. Encapsulation of classes: In short, the member variables in the class are wrapped into private, and then provide the set and get methods to modify and get the value of the 7.static keyword use: Define a static member, can be member variable, member method and static code block effect: (1) The general membership is that each object has a different member, and static is all the objects have one (2) the member is defined as static and can be called directly by the class name Note: (1) The static method can only access the static Member variable (2) The static method cannot inherit a static code block that cannot be overridden (3) before the object is created. Therefore, the non-static method cannot access the static member 8. Inheritance: Subclasses inherit what the parent class:
if the subclass and parent class are in the same package (newborn children)
Public
member
protected
member
default member
If the subclass is not in the same package as the parent class (Adoption child)
Public
member
protected member
rewrite:Method name is the same
same argument list
The return type must be the same scope range cannot be reduced
9. Abstraction:Characteristics of abstract Classes
Abstract classes
can have abstract methods, or no abstract methods can not be instantiated, abstract classes can only be used as a parent class if the subclass does not implement all of the parent class abstract methods, the subclass can still only be abstract class abstract method cannot be private
10. Interface:(1) The member variables in the interface are public static final (2) the methods in the interface are public abstract 11. polymorphic: A reference to the parent class is directed to the object of the subclass;

Java Object-oriented review

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.