---restore content starts---
1Java provides the corresponding wrapper class for 8 types. Because these 8 types are not classes or objects, they should not exist in Java (This is what is said here), it is emphasized that Java allows the value of the basic type directly to the corresponding wrapper class reference variable, also allows the wrapper class object to be assigned to the corresponding basic type variable.
Like what:
BYTE a=10;
BYTE b=new byte ();
b=10;//This is doable D.
a=b;//This is also possible, because the above is emphasized.
The fundamental reason here is that the person who invented Java wanted to be able to unify Java (which is made up of classes), so he wrote into his library What was not originally a class.
How does 2java implement an immutable class? The final keyword is used in Java to decorate classes, methods, and variables. A class that has been modified cannot derive a subclass, a decorated method cannot be overridden by a class, and a modified variable does not allow him to be re-assigned. This is a very powerful place, such as a critical value is fixed, so after the use of final decoration, the value is fixed in memory, with static modifier is a class variable, not decorated is an instance variable (or method), So they become a fixed value when the class is established or the method is established.
For example, the age of age in here is that he is final, so it cannot be modified in any way.
3 abstractand interface Two keywords, he defines an abstraction class and interface. Abstract classes and interfaces are common features of multiple subclasses, and abstract classes are templates for multiple classes, and interfaces define the rules that many classes should follow. It can be said that the abstract class is a teacher, the teacher taught all the students knowledge, all students learn (assuming the subclass is a very clever child), and the interface is the director or school police, he is responsible for the management of many classes let them abide by certain rules. Lambda is the most important update for JAVA8.
The essence of object-oriented is to allow the program to think like the world, to collaborate.
2
Eight types of data in Java
---restore content ends---
Java 8 Enhanced wrapper class