Java Interview and Answers

Source: Internet
Author: User
Tags square root redis cluster

First, the Java Foundation
Why the 1.String class is final.
2.HashMap source code, the realization principle, the bottom structure.

HashMap
3. The difference between class.forname and ClassLoader in reflection
4.session and cookie differences and connections, session life cycle, multiple services deployed when session management.
What is the difference between the queues in 5.Java.
6.Java of memory models and GC algorithms
New features of 7.java7 and Java8 (Baidu Q, good BT)
8.Java array and List of the operational efficiency of the two structures, in which cases (starting from the beginning, starting from the end, starting from the middle), which operations (INSERT, find, delete) the efficiency of high
9.Java Memory Leak problem Survey Location: Jmap,jstack use and so on

Second, the framework
The difference between 1.struts1 and struts2
The difference between 2.struts2 and SPRINGMVC
What jar packages need to be referenced in the 3.spring framework, and the purpose of these jar packages
The principle of 4.springMVC
Meaning of the 5.springMVC annotation
The relationship and difference between beanfactory and ApplicationContext in 6.spring
Several ways to inject 7.spring
8.spring How to achieve the management of things
Principles of 9.springIOC and AOP
How to use and differentiate between Level 1 and 2 cache in 10.hibernate
How to loop injection in 11.spring

Three, multi-threading
1.Java after creating a thread, call the start () method directly and the difference between run ()
2. Common thread pool patterns and usage scenarios for different thread pools
3.newFixedThreadPool this kind of thread pool if the number of threads reaches the maximum, what will be done, the underlying principle.
4. Multi-threaded communication between the synchronization problem, synchronized lock is the object, stretch out and synchronized related to a lot of specific problems, such as the same class different methods have synchronized lock, whether an object can be accessed at the same time. Or the static construction method of a class plus the effect of a lock after synchronized.
5. Understanding the meaning of reentrant locks and the difference between Reentrantlock and synchronized
6. Synchronized data structures, such as Concurrenthashmap's source understanding and internal implementation principles, why he is synchronous and highly efficient
Understanding and Using keywords for thread-safe operations such as 7.atomicinteger and volatile
8. Inter-thread communication, wait and notify
9. Use of timed threads
10. Scenario: In a main thread, a large number of (many) sub-threads are required to execute before the main thread finishes. Many ways to consider efficiency.

Iv. network communication
1.http is stateless communication, the way HTTP requests, you can define a new request method.
2.socket communication, as well as long connection, subcontracting, connection abnormal disconnection processing.
3.socket communication models are used, AIO and NIO.
The use of 4.socket frame Netty, and the implementation principle of NIO, why asynchronous non-blocking.
5. Synchronous and asynchronous, blocking and non-blocking.

Five, Linux
1. Commands that are commonly used by Linux
2. In a large log file, count the number of occurrences of the exception, sort, or specify how many rows to output. (The main study is awk)
Survey problem ideas under 3.linux: Memory, CPU, handle count, filter, find, simulate post and get request, etc.
#! in 4.shell scripts The role

Vi. MySQL Database
Different storage engines for the 1.MYSQL
2. Single index, federated index, primary key index
3.Mysql How to divide the table, and after the table if you want to do a conditional paging query how to do (if not by the table field to query, almost inefficient, no solution)
4. After the table wants to make an ID multiple table is self-increment, the efficiency realization
5.MYSQL master-Slave real-time backup synchronization configuration, and the principle (from the library read the main library binlog), read and write separation
6. Write SQL statements ...
7. Indexed data structure, B + Tree
8. The four characteristics of things, and their characteristics (atoms, isolation) and so on, the project how to solve these problems

Vii. design pattern (write code)
1. Singleton mode: Full Han, a hungry man. and lazy loading in the A Hungry man
2. Factory mode, decorator mode, observer mode.

Eight, the algorithm
1. Using a random algorithm generates a number that requires all of these numbers to be generated between 1-1000w. (Study high efficiency, solve the problem of conflict)
2. Merge sort of two ordered arrays
3. Reverse of an array
4. Calculate the positive square root of a positive integer
5. It is common to look at the sorting algorithm (sort reprint: http://mp.weixin.qq.com/s?__biz=MjM5MTAzMTE4Nw==&mid=204838393&idx=2&sn= E9B50C8EF689E2CB6436110A8DC148A3&SCENE=5#RD)

Nine, Cache
1. Why cache, which caches are used, the difference between Redis and memcache
Data structure of 2.redis
How 3.redis is persisted, and what kind of project is used, why
4.redis cluster understanding, how to dynamically increase or delete a node, and ensure that the data is not lost. (Consistent hash problem)

Java Interview and Answers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.