java focus

1. What is object-oriented? Object
-oriented is a method of applying the idea that everything in the real world is an object to software, using object-based concepts to build models, and simulating the objective world to analyze, design, and implement software. Through the object-oriented concept, the computer software system can correspond one-to-one with the system in the real world.

2. The difference between object-oriented and process

-oriented is to analyze the steps required to solve the problem, and then use functions to implement these steps step by step, and call them one by one when they are used.
Object-oriented is to decompose the transaction that constitutes the problem into various objects. The purpose of creating an object is not to complete a step, but to describe the behavior of a certain thing in the entire problem-solving step.

3. Object-oriented features

Four features: high cohesion, low coupling, extensibility, and reusability
Three features: encapsulation, inheritance, and polymorphism
Encapsulation : refers to encrypting the internal implementation details of objects and controlling external Object's access rights.
Inheritance: The child class inherits the member variables and methods of the parent class, but does not inherit the constructor of the parent class.
Polymorphism: Refers to allowing objects of different classes to respond to the same message. A form of object-oriented presentation: it is mainly divided into upward transformation and downward transformation.

4. Overloading and overriding overload override

Overloading: the return value of the modifier, the same method name, the parameters are different: the number, type, and
sequence Override: the return value of the modifier, the method name, the parameters are the same, the method body is different
, and the override is the relationship between the parent class and the subclass , the modifier of the subclass is greater than the parent class, the subclass solves the exception thrown by the parent class, and can only throw fewer exceptions

5. Four kinds of permissions

public: public permission
protect: subclasses under all packages and the kind
default: all classes in the same package
private: private, only this

class
use.
A class with abstract methods is defined as an abstract class.
However, abstract classes do not necessarily have to contain abstract methods. If a class does not have abstract methods, it can also be declared as an abstract class.
Abstract class: modifier abstract class{}
abstract method: modifier abstract return value type method name (); only declaration, no method body. The method body of the ordinary method is represented by ; in the abstract method.
Subclasses that inherit abstract classes are either abstract classes, or overwrite (implement) inherited abstract methods to become ordinary classes for execution.
Objects created by subclasses of inherited abstract classes are generally used in conjunction with polymorphism.

Defines the criteria for calling objects. Pure (special) abstract classes, only abstract methods, and all abstract methods. (If you do not write abstract, the default is abstract method in the interface.)
Interface: The method in the interface interface is public permission, because the interface can be multi-inherited, so it must be a public permission for all subclasses and subinterfaces to implement or inherit. Subinterface or subclass methods must be
public.
Interfaces generally use subclasses to implement implements, similar to extends (special inheritance) in inheritance. To implement, you must override member methods.
A subclass can implement implements multiple interfaces/a subinterface can inherit extends multiple interfaces/interface support Upward transformation.

7, list set map collection

set: unordered and cannot be repeated
list: Ordered and repeated into
the map: The key-value pair key is not repeatable

8. Process and thread

new Thread(){}.start(); Call the run method of the thread object
new Thread(new Runnable(){}).start( ); call runnable's run method

9. io stream

Byte stream: inputStream outputStream
character stream: inputStreamReader outputStreamWriter
file stream: filrStreamReader FileStreamWriter

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326352007&siteId=291194637