The most complete history 106 Java-frequency interview collection, nine topics, shooting up to 95%

Lack of combat experience? Books obscure? Video tasted? That's because you have not found the right way to learn!

Xiao Bian sorted out Java programmers the necessary core skills, but also interview the interviewer will ask knowledge, the chapter also includes a lot of knowledge, including have a distributed architecture, high availability scalable, high performance, high concurrency , Jvm performance tuning, Spring, MyBatis, Nginx source code analysis, Redis, etc.

Since the share of the documentation of the details too much so just edited the next chapter cursory knowledge of the introductory part, each chapter small node which has more detailed content! The following is part of chapters, because of space limitations explain in detail the directory can not be fully listed, interested friends can click on the below free access to the portal.

Learn the history of the most detailed interview notes free access to the core: Java foundation + algorithm + JVM + database + SSM message queue framework + Redis + + Spring family bucket, etc.The most complete history 106 Java-frequency interview collection, nine topics, shooting up to 95%

General questions about Java

1. What is the JVM? Why say Java is cross-platform programming language?

Java Virtual Machine (Java Virtual Machine) is a Java bytecode may execute a virtual machine , each of the Java source file is compiled into byte code file, and then execute a JVM. The reason why Java is designed to run on any platform, without rewriting or recompiling under different platforms, which thanks to the Java Virtual Machine (JVM), as well as the underlying JVM is well aware of the length of the specific instruction the special nature of the hardware platform.

2. What is the difference between the JDK and JRE are?

Java Runtime Environment (Java Runtime Enviroment) is a basic Java virtual machine to run Java programs, including browser plug-in performs the applet. JDK (Java Development Kit) to develop, compile and execute Java applications, Java software for full-featured development kit, including JRE, compiler and tools (such as   JavaDoc  and Java Debugger ).

3. "static" keyword What does it mean? In Java, you can override private or static methods do? keyword mean? Can you override private or static method in Java?

static keyword indicates that, when you access the member variable or method, without having to obtain an instance of the class to which it belongs.

Java in the static method can not be override, override mechanism is because the runtime (runtime) dynamic binding, while the static method is statically bound at compile time. static methods are not with any kind of specific examples, and therefore can not be applied the concept of inheritance.

4. In the static method can access non-static variables in it?

Static variables in Java classes for all the corresponding normalized, the values ​​for all instances of the class that are the same. JVM static variables are initialized when the class is loaded. If the code attempts to access non-static variable, but not an instance of the class by to visit, the compiler will complain, because these non-static variables has not been created yet, and they are not associated with instances.

5. What data types Java support? What is Autoboxing and Unboxing?
Java language support eight basic data types are as follows:

  • byte

  • short

  • int

  • long

  • float

  • double

  • boolean

  • char

Autoboxing means between classes in basic data types and the corresponding package (warpper) autochanger Java compiler does . For example, the compiler converts int  Integer , a double into a  Double  , and so on. Reverse conversion is referred unboxing.

6. In Java, what is Override methods (coverage) and Overload (overload)?
Condition of overload Java methods happen is that the same class, there are two or more identical method name, but different argument lists . On the other hand, refers to the override method, the same subclass redefines a method of the parent class. Override method must be a method name, parameter list and return type are identical. Override method does not restrict access to the original method.

In 7.Java constructor, overloaded constructor and copy constructor concept
8.Java support multiple inheritance it?
9. interfaces and abstract classes What is the difference?
10. The pass-reference value and

Java threads

11. The difference between processes and threads?
Process is the execution of a program (ie running programs), but the thread is an independent execution sequence in the process. A process can contain many threads. Threads are sometimes called lightweight process .

12. speak different ways to create a thread under which way you prefer and why.?
There are three ways to create threads:

  • Thread class inheritance.

  • Implement Runnable.

  • By creating a thread pool Executor framework.

The preferred way is to achieve Runnable interface, because it does not inherit the Thread class. When your program design requires multiple inheritance, use the interface will be helpful. In addition, the thread pool efficiency is very high, and is very simple to implement.

13. explained next available thread state.
14. A method for synchronizing the sync blocks of the difference?
15. thread monitor how synchronization happens? You can use what level sync?
16. What is deadlock?
17. how to ensure that deadlock does not occur when the N N threads to access resources?

Java Collections

? 18. The basic interface Java Collections Framework
Java Collections Framework  provides a set of well-designed interfaces supported by the object and collection classes operations Java Collections Framework interface is the most basic:

  • Collection , represents a group of objects (elements).

  • The SET , contains a collection of distinct elements.

  • List , contains an ordered collection of distinct elements.

  • The Map , contains non-duplicate key target for the key.

19. Why did not inherit Collection Cloneable and Serializable interface?

Collection interface description objects are elements of the group consisting Each Collection specific implementation may choose their own way to manage the elements. Some collection allows duplicate keys exist, others do not.

Copy semantics and serialization function and effect will be achieved when the actual process. Thus, the specific implementation classes should decide how they would be copied and serialization.

20. What is the Iterator (iterators)?

Iterator interface provides a number of methods can be iterative set. Each set of java ( Collection ) contains one of the iterator method returns an Iterator. Iterator underlying collection element can be removed in the iterative process.

The difference between 21. Iterator and ListIterator?
Difference 22. fail-fast and fail-safe of?
23. The HashMap in the Java how this works?
24. The hashCode () and equals () method of the importance of what?
25.HashMap What are the differences between HashTable and there?
ArrayList between 26.Array and what is the difference? Compared with ArrayList when you use Array?
Between 27.ArrayList and LinkedList What is the difference?
What 28. Comparable and Comparator interfaces are? Listed their differences.
What 29.Java Priority Queue that?
30. Big-O notation about what you know? Can you give some examples it for different data structure?
31. How to weigh ordered and disordered array of arrays?
32. What are best practices for Java Collections Framework there?
33. Enumeration and Iterator interfaces What is the difference?
34. The HashSet and TreeSet What is the difference?

Garbage collector

35. What is the purpose Java garbage collection is that when it is used?

Garbage collection for object recognition and discard procedure is no longer required in order to recover and reuse resources.

36. System.gc () and Runtime.gc () method uses?

These methods are used to remind the JVM to start garbage collection. However, garbage collection start timing is determined by the JVM.

37. finalize () is called when? What is its purpose?

finallize method is to release the object before the memory is invoked by the gc (garbage collector). is generally recommended to release the resources held by the object in this method.

38. If the reference is set to a null object, gc immediately release the object's memory it?
39. What is the structure of the Java heap? Heap Perm Gen (full name is the Permanent Generation) What is space?
40. The Serial garbage recycling garbage collector with Throughput difference?
41. when objects are recovered?
42. garbage collection occurs in the designated area JVM?

Exception Handling 

What are the two 43. Java Exception is the difference between them??
The Java There are two types of exceptions: checked and unchecked (not checked and checked) anomaly if unchecked exception may be in the implementation of the method or constructor. thrown to the outside in order to spread the method or constructor, they do not need to be declared in a method or constructor throws clause. However, checked exceptions must be declared by the throws clause of the method or constructor Proposal for java exception handling Please refer here to the Java Exception Handling .

44. Java exception and error is the difference?

Exception and Error are Throwable subclass of the class.  Exception exception condition for a user to capture program needs.  Error defines the user program exception unforeseen

45. throw and throws the difference?
Throw keyword used in the program explicitly throw an exception. In contrast, throws clause is used to indicate that there is no exception handling in this method. Each method must explicitly specify which exceptions no treatment to the caller of the method can prevent abnormality may occur. Finally, a plurality of abnormal separated by commas.

45. The importance of the finally block of exception handling?
46. The exception is the exception object what happens after treatment?
47. How to distinguish between the finally block to finalize () method?

Java Applets

48. What is Applet?
A Java Applet can contain and can run on Java-enabled client browser in an HTML page. Applets can be used to create dynamic and interactive web applications.

Description 49. Applet life cycle of
an Applet may experience several of the following states:

  • The init : every time you load are initialized

  • Start : start the implementation of an applet

  • STOP : Stop execution of an applet

  • The Destroy : perform final clean up before you uninstall applet

50. What happens when the applet is loaded?
First, it will create an instance of a class control applet. Then, initialize the applet, applet finally started running.

51. Applet and Java applications What's the difference?
Applets need a browser that supports Java, but Java applications can be executed separately. However, they will need a Java Virtual Machine, JVM.

Also, a Java application needs a main method with a specific signature, be sure to start. Java applets do not need something like this.

Finally, Java Applet usually use strict security policies, and Java applications typically use less stringent security policy.

52.  What are the restrictions imposed on Java Applet?
53. What is not credible Applet?
54. The file system loaded applet loaded what the distinction between the Internet and the Applet is?
55. What is the applet class loader, which provides what?
56. What is the applet security manager, what it provides? applet is a Java applet security management mechanism made restrictions. Only one browser security manager. Security Manager built on startup, then it can not be replaced, overloading, rewritten or extended.

Swing

What is the difference between the 57. Choice and a List?
Choice is a compact way to display must be pulled down in order to allow users to see a list of all the available options. Choice can only select one option. List is based on several List options are visible way of illustration. List List supports select one or more options.

58. What is the Layout Manager?
The layout manager is used to organize the components in the container.

What is the difference 59. Scrollbar and JScrollPane is?
Scrollbar is a component , but not a vessel , and ScrollPane a containerScrollPane handle its own events and execute its own slide.

Swing 60. What method is thread safe?
61. Support drawing say three subclasses.
62. What is the cut?
What is the difference 63. MenuItem and CheckboxMenuItem is?
64. BorderLayout element is how the organization?
65. GridBagLayout element is how the organization?
66. Window and Frame What is the difference?
The relationship between cutting and redrawing 67.?
68. What is the relationship between the event and the event listener interface adapter class?
69. a GUI component how to handle their own events?
70. Java layout manager offers more than a traditional window system what kind of advantage?
71. Java design patterns is what all Swing components using?

JDBC

72. What is JDBC?
JDBC is an abstraction layer that allows a user to select between different databases. JDBC enables developers to write database applications in Java , rather than let yourself be concerned about the underlying details of a specific database.

73. The interpretation of the JDBC driver role.
JDBC driver provides specific database vendor to achieve the abstract class provided by the JDBC API. Each drive java.sql package must be provided to achieve the following classes: Connection , the Statement , the PreparedStatement , CallableStatement , the ResultSet  and  Driver .

What is the purpose 74.Class.forName method is?
This method is used to load the driver to establish a connection to the database.

75. The advantage compared to PreparedStatement and Statement?
76. Use of CallableStatement? Pointed out that the method used to create a CallableStatement.
77. What connection pooling is?

Remote Method Invocation (RMI)

78. What is RMI?
Java Remote Method Invocation (RMI) is a Java API, object-oriented equivalent of remote procedure it performs call (RPC) method, including the direct transmission of serialized Java classes and distributed garbage collection stand by. Remote Method Invocation (RMI), can also be seen as a process of activating a remote operation on an object method. RMI provides location transparency, because the user that a method is performed on the object running locally. Tips here Wallpaper RMI .

79. What are the basic principles of the architecture of RMI?
The most important principle will be implemented RMI architecture is defined and acts of behavior are treated. RMI allows behavior definition and implementation of behavior alone and run in a separate JVM code.

What architectural layers 80. RMI is?
RMI structure is divided into the following layers:

  • Pile (the Stub) and the frame (Skeleton) layer: This layer is located below the developer views. This layer is responsible for intercepting client requests method interface and redirect these requests to a remote RMI service.

  • Remote reference layer: the architecture of the second layer is processed and analyzed from the client to the server's remote object references. The layer analysis and management from the client to the remote service object. The connection is a one to one (unicast) connections.

  • Transport Layer: This layer is responsible for connecting two JVM participating in the service. It is based on the machine connected by a network of TCP / IP, provides basic connectivity, as well as some firewalls *** strategies.

81. What RMI remote interface is the role?
82. java.rmi.Naming class role-playing?
83. The RMI bindings What does this mean?
84. The Naming class bind and rebind difference method?
85. To run the RMI program?
The stub of 86.RMI role?
87. What is the DGC? How does it work?
88. What is the use of RMISecurityManager in RMI is the purpose?
89. The explanation marshalling reconciliation group.
90. The explanation serialization and deserialization.

Servlets

91. What is a Servlet?
The servlet is used to handle client requests and generate dynamic web content Java programming language classes. Servlets are mostly used to process the data stored or HTML form submission, status information is provided in a stateless protocol dynamic content management and those that are not HTTP.

92. The interpretation of a Servlet architecture.
The core abstraction is certainly all servlet must implement javax.servlet.Servlet interface. Each servlet must implement this interface either directly or indirectly, may be inherited or javax.servlet.GenericServlet javax.servlet.http.HTTPServlet. Finally, I would mention is that each servlet can use multiple threads to service multiple requests.

93. What a difference a Servlet and Applet is?
A Applet is running in a web browser client machines inside the java client program. In contrast, a servlet is run on a web server service container. A user interface can use the applet class, a servlet but can not have a user interface. Instead, a client waits for the HTTP servlet request and generates a response for each request.

What is the difference 94. GenericServlet and HttpServlet is?
GenericServlet is an implementation-independent Servlet and ServletConfig common protocol interface servlet. GenericServlet those inherited from the servlet class overrides the service method. Finally, I would mention is that in order to develop a Web user to use HTTP servlet HTTP protocol services, your servlet must instead inherited from HttpServlet.

95. explain a Servlet life cycle.
96 .doGet What is the difference between () and doPost () that?
What is 97. web application?
98. What is a server-side include (SSI)?
99. The Servlet chain is what?
100. How do we know the client's information request servlet?
What is the structure 101. Http response is?
102. What is a cookie ? What is the difference between the session and the cookie is?
103. What browser and the servlet communication protocol through?
104. What is the HTTP channel?
Difference 105. sendRedirect and forward method?
106. What is the URL encoding and decoding?

Xiao Bian above interview made a collection order, there are more redis, high concurrency, multithreading, micro-services, distributed, MySQL, database, threads, locks, jvm, Java virtual machine, spring and other exam also interview Share it together, for your reference, you can click the portal below the required free access to all documents Xiao Bian finishing! ! !

Learn the history of the most detailed interview notes free access to the core: Java foundation + algorithm + JVM + database + SSM message queue framework + Redis + + Spring family bucket, etc.The most complete history 106 Java-frequency interview collection, nine topics, shooting up to 95%

Guess you like

Origin blog.51cto.com/14230003/2456087