Questions surface finishing (continuous modification)

1.private modified method can be accessed through reflection, then what is the meaning of private

Reflected by setAccessible (true), this line of code to cancel a java access control checks; private not solve security problems, if you want to solve the security problem code, please use the other way.
Significance of OOP is private (object oriented programming) packaging concept.

2. Initialize the code sequence in java

Common categories :
static variables static block of code common variable common code block constructor
inherited subclass :
parent class static variable parent class static block of code subclass static variables subclass static code block parent class common variable parent class common parent blocks constructor the subclass common variable subclasses normal code block subclass constructor
abstract implementation subclasses: Interface - pumping line class - class that implements
the interface static variables abstract class static variables abstract static block of code implementation class static variables placement class static code block abstract common variable class normal abstract class abstract class constructor code blocks to achieve common variable class normal implementation class implementation class constructor code block
interfaces Note :

  • Variable declarations are static variables and is final, so subclasses can not be modified, and is a fixed value because the instance will not change
  • Interfaces can have static methods, can not have a common method, common methods need to add a default implementation with defalut
  • Interface variables must instantiate
  • No static interface block, common variable, ordinary block constructor

3. a java file has three categories, there are several class files compiled

Regardless of class of this document constitute what, even if it contains interfaces, several classes will generate a few class files.

Mutual exclusion between 4.ReadWriteLock read and write it?

Guess you like

Origin www.cnblogs.com/caiguaismine/p/11110998.html