2017 java development job interview questions worth collecting

The following is my own collection of interview questions for Java posts in 2017, which can be used to prepare for the interview.

1、 Java Foundation

1. Why is the string class final.

2. HashMap source code, implementation principle and underlying structure.

3. Talk about some Java collection classes you know: list, set, queue, map implementation classes...

4. Describe the implementation and differences of ArrayList and LinkedList

5. What are the queues in Java and what are the differences.

6. In reflection, class The difference between forname and classloader

7. New features of java7 and java8 (Baidu asked, good BT)

8. In which cases (from the beginning, from the end, and from the middle) and which operations (insert, find, and delete) are efficient, the operation efficiency of Java array and linked list structures is high

9. Investigation and positioning of JAVA memory leakage: use of jmap and jstack, etc

10. Differences among string, StringBuilder and StringBuffer

11. Differences between hashtable and HashMap

13 . Exception structure, runtime exception and non runtime exception, for example

14. String a= “abc” String b = “abc” String c = new String(“abc”) String d = “ab” + “c” . They compared the results with = =

15. Common methods of string class

16. What are the reference types of Java

17. Differences between abstract classes and interfaces

18. The basic type and byte size of Java.

19. Underlying implementation principle and thread safety of hashtable, HashMap and concurrenthashmap (it is recommended to be familiar with JDK source code before answering calmly)

20. If you don't use the tools provided by Java JDK and implement a map yourself, what do you do. For a long time, I talked about the source code of HashMap. If I did, I would learn from the principle of HashMap and talk about the implementation of HashMap

21. What about hash conflict? What are the ways to resolve hash conflicts?

22. The HashMap conflict is very serious, and the performance is the worst. How would you solve it? From O (n) to log (n), I explained it with the idea of binary sort tree

23. rehash

24. How to rewrite hashcode() and equals() generation algorithms and methods

2、 Java IO

1. Talk about the common classes in io, such as byte stream, character stream, interface, implementation class and method blocking.

2. Talk about NiO.

3. What is the difference between string encoding UTF-8 and GBK?

4. When to use byte stream and character stream?

5. How to recursively read the files under the folder

3、 Java Web

1. The difference and relationship between session and cookie, the life cycle of session, and session management when multiple services are deployed.

2. Some related problems of Servlet

3. Web service related issues

4. JDBC connection, forname method steps, how to declare and use a transaction. Examples and specific codes

5. Configure web without framework Main configuration contents of XML

6. Difference between JSP and Servlet

4、 JVM

1. Java Memory Model and GC algorithm

2. What has JVM performance tuning done

3. Introduce the seven regions in the JVM, and then explain the possible memory overflow caused by each region

4. Introduce abnormal references of GC and GC root.

5. I started from the classload loading mode and loading mechanism, from the program runtime data area to memory allocation, string constant pool, JVM garbage collection mechanism, algorithm and hotspot. It's all extensions anyway

6. How the JVM allocates direct memory, how the new object is not allocated on the heap but on the stack, and how the constant pool is parsed

7. How large is the array placed in the older generation of the JVM (it's not just about setting the pretenuesizethreshold, but how large it is usually. You can know without asking)

8. Access methods of arrays in the elderly generation

9. GC algorithm, how to GC permanent generation objects and how to deal with GC rings

10. Who will be GC and when

11. What if you don't want to be GC

12. What if you want to survive in GC once

5、 Open source framework

1. The difference between hibernate and ibatis

2. Talk about the connection pool of mybatis.

3. Which jar packages need to be referenced in the spring framework and the purpose of these jar packages

4. Principle of spring MVC

5. Meaning of spring MVC annotation

6. Relationship and difference between beanfactory and ApplicationContext in spring

7. Several methods of spring injection (cyclic injection)

8. How does spring manage things

9. springIOC

10. Principle of spring AOP

11. Usage and difference principle of level 1 and level 2 cache in Hibernate (understood by lazy load)

12. Principle and architecture of hibernate, five core interfaces, three state transitions of Hibernate objects, and transaction management.

6、 Multithreading

1. After Java creates a thread, the difference between directly calling the start () method and run ()

2. Common thread pool modes and usage scenarios of different thread pools

3. Newfixedthreadpool this kind of thread pool, what will happen if the number of threads reaches the maximum? The underlying principle.

4. Synchronization of communication between multiple threads. Synchronized locks are objects. There are many specific problems related to synchronized. For example, different methods of the same class have synchronized locks, and whether an object can be accessed at the same time. Or the static constructor of a class plus the lock after synchronized.

5. Understand the meaning of reentrant lock and the difference between reentrantlock and synchronized

6. Synchronous data structures, such as the source code understanding and internal implementation principle of concurrenthashmap. Why is it synchronous and efficient

7. Understanding and use of keywords for thread safe operations such as atomicinter 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, many) sub threads are required to execute before the main thread is completed. Various ways to consider efficiency.

11. Difference between process and thread

12. What is thread safety? Examples

13. Several thread states

14. Concurrent and synchronous interfaces or methods

15. Is HashMap thread safe and why not. Concurrenthashmap, thread safe, why safe. What is the underlying implementation.

16. Use of common classes under j.u.c. In depth investigation of ThreadPool; Use of BlockingQueue. (the difference between take and poll, put and offer); the implementation of atomic classes.

17. Briefly introduce multithreading, starting with the establishment of a thread. Then how to control the synchronization process, the common methods and structures of multithreading

18. Understanding of volatile

19. There are several ways to realize multithreading. How to do multithreading synchronization? Talk about some common methods in threads

7、 Network communication

1. HTTP is stateless communication. What are the HTTP request methods? Can you define a new request method yourself.

2. Socket communication, and handling of long connection, subcontracting and abnormal disconnection of connection.

3. Use of socket communication model, AIO and NiO.

4. The use of socket framework netty, the implementation principle of NiO, and why it is asynchronous and non blocking.

5. Synchronous and asynchronous, blocking and non blocking.

6. OSI seven layer model, including some basic knowledge of TCP and IP

7. The difference between HTTP and get post

8. Talk about the relationship and difference between HTTP, TCP and UDP.

9. Talk about browser access http://www.taobao.com , what kind of process has it gone through.

10. HTTP protocol, HTTPS protocol, SSL protocol and complete interaction process;

11. TCP congestion, fast return, IP packet discarding

12. A process of HTTPS processing, symmetric encryption and asymmetric encryption

13. Characteristics and differences of head

8、 Database mysql

1. Different storage engines of MySQL

2. Single index, joint index and primary key index

3. How to divide MySQL tables and what to do if you want to query by criteria after splitting tables (if you don't query by table fields, it's almost inefficient and has no solution)

4. After splitting tables, you want one ID and multiple tables to be self increasing, so the efficiency can be realized

5. Configuration and principle of master-slave real-time backup synchronization of MySQL (reading binlog of master database from database) and separation of read and write

6. Write SQL statements...

7. Data structure of index, B + tree

8. The four characteristics of transactions and their respective characteristics (atom, isolation), etc. How can the project solve these problems

9. Database lock: row lock and table lock; Optimistic lock

10. Several granularity of database transactions;

11. Differences between relational and non relational databases

9、 Design pattern

1. Single case mode: full man and hungry man. And the delayed loading in the hungry man, double check

2. Factory mode, decorator mode and observer mode.

3. Advantages of factory method mode (low coupling, high cohesion, open and closed principle)

10、 Algorithm

1. Use a random algorithm to generate a number. It is required to generate all these numbers between 1-1000w. (investigate efficiency and solve conflict problems)

2. Merge sorting of two ordered arrays

3. Reverse order of an array

4. Calculate the positive square root of a positive integer

5. To put it bluntly, they are the common search and sorting algorithms and their time complexity

6. Traversal algorithm of binary tree

7. DFS, BFS algorithm

9. Basic understanding and general implementation of important data structures, such as linked list, queue and stack.

10. Sorting algorithm and space-time complexity (why is fast scheduling unstable and why is your project still in use)

11. Inverse Polish calculator

12. Hoffman code

13. Search tree and red black tree

11、 Concurrency and performance tuning

1. There are 5K requests per second to query the written test questions of the location of the mobile phone number (incomplete and not listed). How to design the algorithm? How to design the whole system with more requests, such as 5W?

2. How does our system support a large number of requests in the case of high concurrency

3. How does the cluster synchronize session status

4. Principle of load balancing

5 . If there is a large number of accesses to the database, how to optimize it (DB design, dbio, SQL optimization, Java optimization)

6. In case of large-scale concurrency, how to solve the problem of untimely server response without adding servers.

7. If there is a performance bottleneck in your project, what do you think may be and how to solve the problem.

8. How to find the location causing the performance bottleneck and which location is the performance bottleneck.

9. Have you ever used caching mechanism in your project? Is there a non local cache for users

12、 Other

1. Common commands under Linux

I wish you a smooth interview!

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>