Brush daily summary title

1. About AOP is wrong? (C)

A.AOP will be scattered in the system "aspect" code set to achieve
B.AOP help improve system maintainability
C.AOP has been shown to be an alternative object-oriented trend
D.AOP is a design pattern, Spring provides an implementation

Parsing: AOP and OOP is a methodology, it can be said as design patterns, ways of thinking, the theoretical rules and so on.
AOP can not replace OOP, OOP is obejct abstraction, while AOP is concern abstraction, the former is mainly abstract objects, such as certain types of business object abstract public interface, business logic is encapsulated report objects, more focus on certain common objects have in common abstract behavior, such as reporting module requires special report business logic package, other modules need other logical abstraction, while AOP is a common behavior dispersed in each module of the abstract, that is the focus of abstraction. Some system-level problems or total service independent thinking and many existing functions together, you can use AOP, such as abnormal information processing mechanisms of the unified custom exception information is written to the response stream and then to the front display, operated by the user logging behavior the methods, to do these things with OOP is a good interface, call around, but sometimes find most of the logic module calls too consistent, and no great relationship with the core business, may be open to independent, so deal people deal with the core business to focus on core businesses, separation of concerns, and naturally the code more independent and easier to debug analysis, more good maintenance.
OOP core business still have to come into play, with the focus AOP is not the same, the former kind of vertical abstract sense, the latter is transverse abstract feeling, just to add to OOP AOP, no substitutes.

2. Description of the abstract class is correct (D)

A. abstract methods are abstract class
B. A class can inherit an abstract class plurality
C. abstract class constructor can not have
D. abstract class that can not be instantiated

Analytical:
A. An abstract class can have non-abstract methods, and interface methods are abstract
B.java only single inheritance class, interface 'inherited' plurality of interfaces
C. abstract class must have a constructor, an interface certainly no constructor
D. refers generally to instantiate a new object, an abstract class is not instantiated

3. inner classes (also called members of the inner class) can have four access. (A)

A. True
B. False

Analysis: inner classes are declared directly within the class. It can be declared as private, protected, public or default access

4. Regarding the final statement is correct? (B)

A.final class class method definitely can not be accessed with a package
method B.final class can access the same class is not determined by the packet Final
C.final method is equivalent to the private method
D.final reference to the object itself and value do not change

Analytical: final variable, if it is the basic data type, its value can not be changed once after initialization. If it is a reference type variable, then after its initialization, we can not point to another object, but there's value can be changed. Content object reference variable points in can be changed.

The correct description is about the anonymous inner class? (B)

A. anonymous inner classes inheriting from a base class, an interface can not implement
B. not anonymous inner classes defined constructor
C. for not anonymous inner classes parameter
D. above statement is not correct

Analysis: As the name of the constructor must be the same as the class name, and the name of the anonymous class has no class, so anonymous classes can not have constructors.

Difference 6.final, finally and finalize, the following statement is correct there? (AB)

A.final used to declare properties, methods, and classes, attributes can not be changed, respectively, the method can not be overwritten, the class can not be inherited.
B.finally exception handling part of sentence structure, means always executed.
C.finalize is a method of the Object class, at the time of execution of the garbage collector calls this approach is subject to collection, recycling can override this method to provide other resources when garbage collection, such as closing files.
D. After the final reference variable is modified and can no longer point to other objects, the content it points to an object is immutable.

Analysis: When modifying a variable with the final keyword, refer to reference variables can not be changed, the content object reference variable points in the still can be changed.
finalize method, this option would be wrong in this method an object can only be executed once, can only be recycled into the first queue,
and objects belonging to the class overrides the finalize method will be executed. The second time recovered into the queue, it will not execute the finalize method,
but is secondarily directly labeled, the next time the GC GC.

Published 10 original articles · won praise 0 · Views 175

Guess you like

Origin blog.csdn.net/CHgoing/article/details/104425842