Tips1: Eclipse will often use the System.out.println method, you can enter SYSO first, then eclipse will automatically associate with this statement!!
Learning experience:
* Initialization
* Package, permission control
1. The package concept was introduced to prevent class name collisions. The package statement is to be the first statement of the Java source file.
2, two classes in the same package, can call each other, two classes in different packages, if you want to reference it must be imported through the import statement, in the format: Import package name. The class name.
3. If the same name of two packages is imported in the program at the same time, the complete "package. Class name" must be clearly written when used, such as: Access.a.demo demo1=new Access.a.demo ()
4. The properties and methods of the private type can only be used in this class; properties and methods of the protected type are only available in this package; properties and methods of the public type can be used everywhere.
* Inheritance
1. Inheritance modifier and access restriction relation table
For example, protected decorated members can be accessed within a quilt class, the same package, or inside a class.
2. The properties and methods of the parent class private type cannot inherit from the quilt class, nor can the parent class inherit the quilt class.
3. When a subclass object is instantiated, the constructor of the parent class is called before the subclass itself is called. If the parent class constructs a method with parameters, then the subclass should display the Super method (written in the first line) in the constructor method.
4. Only single inheritance is allowed in Java, that is, a class can inherit only one parent class.
5. Method override (Override): A method with the same name in the parent class is defined in the subclass. The overridden method must have the same method name, parameter list, and return type as the overridden method.
6. The subclass override method cannot have more restrictive access control permissions than the parent class method. Static methods cannot be overridden.
7. All Java classes have a common parent class The Object,object class contains the following main methods:
Public String toString ()//object output when called, default output: Class name @hashcode, can overload this method
public boolean equals (object obj)//Object comparison
public int hashcode ()//Get the object's hash code
8, the Equals method by default compares the address that the object holds in memory, but if it is a custom class, you can override the Equals method as needed;
= = Method for a basic data type, it compares the value, and for a composite data type, it compares the address of the object.
* Container
1, HashMap The Put method returns the value, if the value that is put in exists returns the corresponding value, otherwise returns null
Java Learning Notes--Basic articles