Java exam knowledge points

1.java basic programming unit is a class, the basic storage unit is variable;

2. For the purposes of .java files, a file can have more than one class, but a class can only have a consistent and .java files. Exist outside the public once the class .java file, then the class name so outside the public class must match the file name of .java. But considering the internal class, a .java file can have multiple internal public classes, these are also the names and .java name suggests.

3.AOP and OOP difference: 

A step or stage (1) Aspect Oriented Programming AOP emphasis of the business process, emphasis to reduce the coupling between modules, so that the code has a better portability.

(2). Object-oriented programming (OOP) are extracted in the business entity analysis methods and properties of the package. AOP can be said for the verb is in the field of business, OOP terms for the field. A very important feature of AOP is the source code-independent, which means that if our system components referenced in AOP, even if we remove the component, system code should be able to compile. To do this, you can use the dynamic proxy mode.

Character code set 4.java language using Unicode.

 Unicode (Unicode, Unicode, single) in the field of computer science is an industry standard, including character sets, coding schemes.

To address the limitations of traditional Unicode is a character encoding scheme generated, it is set for each language for each character in a unified and unique binary code, in order to meet the cross-language, cross-platform text conversion processing requirements. Unicode is a character encoding scheme can accommodate all signs and symbols of the world elaborated by international organizations. Unicode character currently organized into 17 groups, 0x0000 to 0x10FFFF, each referred to a plane (Plane), and each plane has 65,536 yards bits, a total of 1,114,112. However, there is only a small number of planes. UTF-8, UTF-16, UTF-32 are converted to digital data coding scheme of the program.

5. (1) HashMap and Hashtable two classes implement the Map interface, both to save KV (key-value pairs)

(2): HashTable allowed null value (key value and can not), HashMap allows null values ​​(key and value may be).

(3): Hashtable method is Synchronize, while HashMap is not, when multiple threads access Hashtable, do not need to sync method for its realization, but it is necessary to provide them HashMap external synchronization.

(4): a "collection view methods" of all classes HashMap returned iterators are fail-fast: after the iterator is created, if changes to the map structurally, except through the iterator's own remove method, other modification, the iterator any time in any way have thrown ConcurrentModificationException. Hashtable and HashMap main difference is that the former are synchronized, which is a mechanism to ensure rapid failure.

6. (1) in the presence of a member with the same name child-parent class, subclass, the default access subclass members, the members can access the parent super class specified in the format:

super.xx (Note: xx is a member of the name);

When (2) create a sub-class object, the default no-argument constructor calls the parent class, you can specify call the superclass constructor other format via super:

s uper (yy) (NOTE: yy is the parent class constructor parameters need to pass)

7. Java multi-threaded in a preemptive mechanism, rather than time-sharing mechanism. Preemptive mechanism is more than one thread in a runnable state, but only one thread is running.

 wait () and sleep ()

In common: (1) they are in a multithreaded environment, it can block the number of milliseconds specified in the call of the program and returns.

(2). Wait () and sleep () can () method to interrupt the thread suspended state by interrupt, so that the threads are instantly thrown InterruptedException. If thread A now wants to end the thread B, the method can invoke the interrupt corresponding to the thread B Thread instance. If at the moment thread B is wait / sleep / join, then thread B will immediately throw InterruptedException, direct return safely to the end of the thread catch () {} in. Note that, InterruptedException is thrown from within its own thread, not interrupt () method throws. On a line

When the procedure calls interrupt (), if the common thread is executing code, then the thread would not throw InterruptedException. However, once the thread into the wait () / sleep () / join (), will immediately throw InterruptedException.

Different points: (1) Each object has a lock to synchronize access control. Synchronized keyword can interact with objects and locks to synchronize threads. The method of sleep does not release the lock, the lock release wait method, so that other threads may be used or a method of a synchronization control block. (2) .wait, notify and notifyAll only synchronous or a synchronous control method for use inside the control block, and can be used anywhere sleep

(3) .sleep exception must be captured, and wait, notify, and do not need to catch exceptions notifyAll

  (4) .sleep is a method of the Thread class (Thread), leading to this thread to suspend the specified time, the opportunity to perform to the other thread, but monitoring status remains, to the post will be automatically restored. Call sleep will not release the object lock.

(5) .wait is a method of the Object class, object calls this method leads to wait this thread to give the object lock, waiting to enter the pool waiting for a lock for this object, and only issued after notify method (or notifyAll) this thread for this object before entering objects lock the pool to get ready to lock the object into operation.

8. The pipeline is actually a fixed size buffer, the process for the pipe ends of the pipeline, is a file, but it is not a common file, it does not belong to a certain file system, but live on their own, constitute a single kind of file system, and exists only in memory. It is similar to the process communication mechanisms of the half-duplex channel, a conduit bidirectional data transmission can be achieved, while the same time there is at most only one direction of transmission, can not be performed simultaneously in both directions. The size of the pipeline capacity is usually one on memory, its size is not limited by the size of the disk capacity. When the pipe is full, the process of writing the pipeline is blocked, and when the pipe is empty, the process of reading the pipeline will be blocked.

9. The method of rewriting (the override) two with a small two principle:

  The same method name, parameters of the same type

   Return Type subclass less super method return type,

  Subclasses of the parent class or less thrown method throws an exception,

  Subclasses access method or greater access to the parent class.

10. The class is done by loading the class loader, class loader comprises: a loader root (BootStrap), extended loader (the Extension), the system loader (System) and user-defined class loader (java.lang. ClassLoader subclass). From Java 2 (

JDK 1.2) begin, class loading process adopted father commissioned mechanism (PDM). PDM better guarantee the safety of the Java platform, in this mechanism, JVM comes is the root Bootstrap loader, loader other has one and only one parent class loader. Loading first class the parent class loader loads the request, the parent class loader when its inability self loading loader subclass. Bootstrap JVM does not provide a reference to the Java program. The following is a description of several classes loader: • Bootstrap: general use native code implementation, responsible for loading the JVM basic core class libraries (rt.jar); • Extension: java.ext.dirs system is loaded from the directory specified attribute library, its parent loader is Bootstrap; • system class loader: also known as application class loader, its parent is Extension. It is the most widely used class loader. Classpath it from the environment variable or system attributes described java.class.path directory specified class, user-defined default parent loader loader. • User-defined class loader: java.lang.ClassLoader subclass parent delegation mechanism can be modified, some servers are custom class loader priority.

11. The size of the rule, from small to large

byte short  int  long   float  double  char

Reference type conversion: upcast: downcast:

12. (1), a subclass can inherit an abstract class (virtual class), but it can achieve a plurality of interfaces;

   (2), there may be an abstract class constructor, interface has no method of construction;

   (3), the method is not necessarily an abstract class is an abstract method, in which the method can be implemented (with a method thereof), the interface methods are abstract methods, a method can not have the body, only the statement;

   (4), an abstract class may be public, private, protected, default, only public interfaces;

   (5), a method of abstract class may be public, private, protected, default, interfaces and methods can only be public default

13. A class load order.

 (1) Static parent class code block (including static initialization block, static properties, but does not include a static method)

 (2) subclass static code block (including static initialization block, static properties, but does not include a static method)

 (3) non-static parent class code block (initialization block comprises a non-static, non-static properties)

 (4) the parent class constructor

(5) a subclass of non-static block (initialization block comprises a non-static, non-static properties)

 (6) subclass constructor

14. Abstract class

Features:

(1) An abstract class constructor can

(2) An abstract class common attributes, methods, static methods and properties may be present.

(3) An abstract class may be present in the abstract method.

(4) If there is an abstract method in a class, then the current must be abstract class; not have an abstract class abstract methods.

(5) an abstract method of the abstract class, subclass needed to achieve, if the child class does not implement, the need to define a subclass of abstract.

interface

(1) Only the method of declaration in the interface, there is no method body.

(2) In the interface only constants, because defined variables at compile time default will add public static final

  (3) The method in the interface, always have been modified public.

(4) interface method is not configured, can not interface of the object instance.

(5) The interface can implement multiple inheritance

(6) The method defined in the interface implementation class will need to implement all of the methods of the interface class can not be realized if implemented

(7) the class definition is implemented as an abstract class.

15. In a java unicode 2 bytes (byte). A byte is equal to 8 bits (bit). Unicode code so that each occupies 16 bits.

Guess you like

Origin www.cnblogs.com/hole/p/11311856.html