Java_ encapsulation
Still dazzling 2021-06-04 08:49:52

classification ( layered ) thought

dao layer ( Data access layer ): The operation of data management ( increase 、 Delete 、 Change 、 check ). database 、 Array 、 aggregate

service layer ( The business layer ): Do some specific business operations

controller( Control layer ): To receive user data , Leave it to the business layer for processing .

domain layer ( Entity class ): Used to encapsulate data

JavaBean Class has the following rules :

1) Privatization member variable

2) To have a null parameter construction method

3) Want to have get and set Method

 

Definition of package and leading package

1. What is a bag ?

Packages are essentially folders , It's for class files (.java) Classified management

2. Definition package

package Package name ; // Don't write it yourself ,idea It will be automatically replenished

3. Access to classes between different packages

import Package name ; // Tell compiler , Go to which folder to find this class

give an example :  import java.util.Random;

4. If there are many kinds of duplicate names , You can use the full class name to distinguish

java.util.Random r=new java.util.Randm();

java.util.ArrayList<String> list=new java.util.ArrayList<>(); 

 

 static Features of keywords

1.static Modified variables can be shared by all objects of this class

2. By static Decorated variable 、 Methods can be called directly by class names

3. Static is loaded as the class is loaded , Prior to the existence of objects

matters needing attention :

1. Static methods can only access static methods or static variables

2. There must be no errors in static methods this keyword

Please bring the original link to reprint ,thank
Similar articles

2021-08-09

2021-08-09