Java serialized 50-import import, access control permissions modifier

A, import

1.import import statement is used to complete the other classes, the same packet do not need to import the class

You do not need to manually import the same package.

2.import syntax

 

import the class name; 

import package name *. ; 

// import statements need to write a statement to the package under, class statements above.

 

 

3.java.lang *;. No manual introduction, the introduction of the system automatically.

lang: language language pack is a core class java language, no manual introduction.

4. Final conclusion:

When do I need import?

Using external class, external method

5. Shortcuts

Quick guide package, we use a class does not know where the time just click ctrl + shift + o

 

Package com.bjpowernode.java_learning; 


Import com.bjpowernode.java_learning *. ; 

// use imported package, other packages may be introduced, where the classes can be used directly. 

Import Classes in java.util *. ; 

public  class D50_1_ { 

  public  static  void main (String [] args) { 

    Math49 M1 = new new Math49 (); 

    com.bjpowernode.java_learning.Math49 M2 = new new com.bjpowernode.java_learning.Math49 (); 

    // the above two methods are compiled by the course, and the second is the formal, but also in this category because the first package 

    // the compiler can also, if it is cross-package will give an error 

   

  } 

}

 

Second, access control permissions modifier

1. Access modifiers control authority to control access to a range of elements

2. Access rights control characters include:

i.public publicly expressed, can be accessed at any position

ii.protected same package, subclass

iii. Default same package

iv.pirvate represents private and can only be accessed in this category

3. Access control operator privileges can be modified classes, methods, variables ......

4. modifier ranges:

private<缺省<protected<public

5. Note: class can use the default public and modified forms (except internal)

V. Source:

D50_VisitControlAuthoritySymbol.java

address:

https://github.com/ruigege66/Java/blob/master/D50_VisitControlAuthoritySymbol.java

2.CSDN: https: //blog.csdn.net/weixin_44630050 (Xi Jun Jun Moods do not know - Rui)

3. Park blog: https: //www.cnblogs.com/ruigege0000/

4. Welcomes the focus on micro-channel public number: Fourier transform public personal number, only for learning exchanges, backstage reply "gifts" to get big data learning materials

 

 

Guess you like

Origin www.cnblogs.com/ruigege0000/p/11846304.html