Java Intermediate and Advanced Interview Questions

1. Basic knowledge:

1) Collection class: List and Set comparison, respective subclass comparison (ArrayList, Vector, LinkedList; HashSet, TreeSet);

2) The underlying implementation of HashMap, and then the underlying implementation of ConcurrentHashMap will be asked;

3) How to implement HashMap sequential storage: you can refer to the underlying implementation of LinkedHashMap;

4) The difference between HashTable and ConcurrentHashMap;

5) The difference between String, StringBuffer and StringBuilder;

6) What are the methods of Object: for example, there is a wait method, why there is;

7) The difference between wait and sleep must be understood;

8) JVM memory structure, JVM algorithm;

9) The difference between strong reference, soft reference and weak reference;

10) How the array is allocated in memory;

11) Which design patterns have been used, write one by hand (except for singletons);

12) What is the core of springmvc, how is the request process handled, and how is the inversion of control implemented;

13) What is the principle of aop in spring;

14) How mybatis handles the result set: reflection, it is recommended to look at the source code;

15) Where is the polymorphism of java;

16) What is the use of the interface;

17) Talk about http, https protocol;

18) tcp/ip protocol cluster;

19) osi five-layer network protocol;

20) Difference between tcp and udp;

21) Which encryption algorithms have been used: symmetric encryption, asymmetric encryption algorithms;

22) Talk about tcp shaking hands three times and waving four times;

23) The difference between cookie and session, how to save user state in a distributed environment;

24) git, svn difference;

25) Please write a stack overflow and heap overflow code;

26) Can ThreadLocal be used to share data;

2. IO:

1) The difference between bio, nio, and aio;

2) nio framework: the implementation principle of dubbo;

3) What protocol communication is used by jsf within JD.com: please refer to the protocol of dubbo;

3. Algorithm:

1) What data structures are the heap and stack often mentioned in java; in addition, why are they divided into heap and stack to store data.

2) How TreeMap inserts data: left-handed, right-handed, and double-handed of a binary tree;

3) What method can be used to insert data into a sorted array? A: Dichotomy; Q: What is the time complexity?

4) Balance the time complexity of the binary tree;

5) When to use Hash algorithm and binary tree algorithm respectively;

6) Graph breadth-first algorithm and depth-first algorithm: see the implementation of garbage collection in jvm for details;

4. Multithreading related:

1) Talk about the implementation of blocking queue: you can refer to the underlying implementation of ArrayBlockingQueue (both lock and synchronization);

2) The way of process communication: message queue, shared memory, semaphore, socket communication, etc.;

3) Which classes of concurrent packages have been used;

4) Where is multi-threading used;

5) Which thread pools can Executors generate;

6) Why use a thread pool;

7) Usage of the volatile keyword: make variables visible in multiple threads;

Five. Database related (mysql):

1) msyql optimization experience:

2) mysql statement optimization, what tools to use;

3) mysql index classification: B+, hash; what index to use in any situation;

4) What are the storage engines of mysql and what are the differences;

5) Talk about the characteristics and isolation level of the transaction;

6) How to realize the difference between pessimistic locking and optimistic locking;

6. mq:

1) What is the principle of mq: a bit big. . can say;

2) How does mq ensure real-time performance;

3) How is the persistence of mq done;

7. Nosql related (mainly redis):

1) The difference between redis and memcache;

2) What have you done with redis;

3) How redis is persistent: rdb and aof;

4) How to synchronize the redis cluster;

5) What is the data addition process of redis: hash slot;

6) What are the elimination strategies of redis;

7) What data structures does redis have;

Eight. zookeeper:

1) What is zookeeper;

2) Where is zookeeper used;

3) The selection process of zookeeper;

4) How to communicate between zookeeper clusters;

5) What method is used for node encryption of your zookeeper;

6) The realization process of distributed lock;

9. Linux related:

1) What are the commonly used commands in linux;

2) How to get the pid of the java process;

3) How to get the network port number of a process;

4) How to print logs in real time;

5) How to count the number of lines of a certain string;

10. Design and Thought:

1) Have you refactored the code? talk about experience

2) How to achieve real-time ranking of 10 million users;

3) How to achieve 50,000 people to grab tickets concurrently;

I have a WeChat public account, and I often share some dry goods related to Java technology; if you like my sharing, you can use WeChat to search for "Java Head" or "javatuanzhang" to follow.

Guess you like

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