2019-05-29 java learning diary

Object-oriented _ permissions modifier

Keyword package, package

1, the byte code (.class) kept classified

2, the package is actually a folder

Note: usually the domain name upside down, followed by the function or module

Such as by Function:

com.xxx.add
AddStudent
AddTeacher

com.xxx.delete
AddStudent
AddTeacher

...

Such as by Function:

com.xxx.teacher
AddTeacher
DeleteTeacher
...

com.xxx.student
AddStudent
DeleteStudent
...

 

 

Custom packages and precautions

Format definition package

package package name; multistage coated with a separate can. The single-stage packet: package com;

Notes defined package

1, package statement must be the first executable code of the program

2, package statement in a java file can have only one

3, if there is no package, no representation default package name

 

 

Class with a package compiled and run

 

Guess you like

Origin www.cnblogs.com/Sherwin-liao/p/10950740.html