Reference: http://blog.csdn.net/jackfrued/article/details/44921941
Said without permission not reproduced, I had to refer to.
1. What are the aspects of object-oriented features?
- Abstract: Abstraction is the process of constructing classes by summarizing the common features of a class of objects, including both data abstraction and behavioral abstraction. Abstractions focus only on what properties and behaviors the object has, and do not care what the details of those behaviors are.
- Inheritance: Inheritance is the process of creating a new class from an existing class to get inherited information. The class that provides the inheritance information is called the parent class (hyper-tired, base class); The class that gets the inherited information is called a subclass (derived class). Inheritance allows the software system in the transformation to have a certain continuity. At the same time, inheritance is also an important means of the variable factors in encapsulation program.
- Encapsulation: Encapsulation is generally considered to be the binding of data and the method of manipulating data, and access to data can only be achieved through defined interfaces. The essence of object-oriented is to portray the real world as a series of completely autonomous and closed objects. The method we write in the class is a encapsulation of the implementation details, and we write a class that encapsulates the data and data operations. It can be said that the encapsulation is hidden together to hide things, only to the outside world to provide the simplest programming interface.
- Polymorphism: Polymorphism allows different subtype objects to respond differently to the same message. The simple thing is to invoke the same method with the same object reference but do something different. Polymorphism is composed of compile-time polymorphism and runtime polymorphism. If the method of an object is a service provided to the outside world for an object, then the runtime polymorphism can be interpreted as: calling different subclass objects to replace the parent class object. The method overloads (overload) implement compile-time polymorphism (which is also a pre-binding), while the method override (override) implements runtime polymorphism (also known as post-binding). Runtime polymorphism is the essence of object-oriented, there are two things to do to achieve polymorphism: 1 method Overrides (subclass inherits parent class and overrides existing or abstract methods in parent Class) 2 object styling (referencing child class objects with parent Class)
2. Access modifier permissions
Permissions are divided into: current class, same package, subclass, other packages
Public can be, protected other packages, the default is under the same package can be, private only oneself can.
Is 3.String a basic data type?
Answer: No. Basic types in Java 8: Byte,short,int,long,float,double,char,boolean; In addition to the base type (primitive type) and enumeration type (enumeration type), All that is left is the reference type (reference type).
4.float f=3.4
Error, default is double, need to strong turn, or f=3.4f;
5.int and integer
In order to manipulate the base data type as an object, integer is the wrapper class (wrapper class).
The integer cache is 128 to 127. Therefore, the integer object within this range is the same, = = True. The other is false.
6.& and &&
& Linked operators are evaluated. && is a short-circuit operation that stops the calculation if there is an error in the current face expression.
7. Explaining the in-memory stack
Questions on Java basic plane