Interview question sharing: Section 1 of the most complete Java interview questions in 2018!

             

A few days ago, some friends in the exchange group asked questions related to the interview. At that time, they gave some questions. I was too tired to type. I didn’t write it down, but I thought it was a very irresponsible performance, so I sorted it out. Private collections in recent years, I would like to share them with you!

This set of interview questions is suitable for interviews at all stages of Java development, but it is more biased towards junior and intermediate developers! Since the answer to each question is not unique and the answer can be found on the Internet, only the question is given here, and the reference answer is not listed.

1. Basics

1.1, Java basics 

  • Object-Oriented Traits: Inheritance, Encapsulation, and Polymorphism

  • The difference between final, finally, finalize

  • What are the similarities and differences between Exception, Error, runtime exception and general exception

  • Please write 5 common runtime exceptions

  • What is the difference between int and Integer, the value cache range of Integer

  • Packing classes, boxing and unboxing

  • String、StringBuilder、StringBuffer

  • The difference between overloading and overriding

  • What is the difference between abstract class and interface

  • Talk about the use and implementation of reflection

  • Talk about the scene and implementation of custom annotations

  • The difference between GET and POST methods of HTTP requests

  • Difference between Session and Cookie

  • List your commonly used JDK packages

  • MVC design thinking

  • Difference between equals and ==

  • The difference and connection between hashCode and equals methods

  • What is Java serialization and deserialization and how to implement Java serialization? Or please explain what the Serializable interface does

  • Common methods in the Object class, why wait notify is placed in Object?

  • How Java's platform independence manifests itself

  • Difference between JDK and JRE

  • What's new in Java 8

1.2, Java common collection

  • Difference between List and Set

  • The connection between Set and hashCode and equals method

  • Difference between List and Map

  • Difference between Arraylist and LinkedList

  • Difference between ArrayList and Vector

  • Difference between HashMap and Hashtable

  • Difference between HashSet and HashMap

  • The difference between HashMap and ConcurrentHashMap

  • The working principle and code implementation of HashMap, when to use the red-black tree

  • The problem of HashMap infinite loop in the case of multi-threading

  • HashMap has the problem of Hash DOS attack

  • The working principle and code implementation of ConcurrentHashMap, how to count the number of all elements

  • Handwritten simple HashMap

  • Have seen the source code of those Java collection classes

1.3. Processes and threads

  • The concepts of threads and processes, the concepts of parallelism and concurrency

  • How to create a thread and its implementation

  • How to communicate between processes

  • Talk about the principle and difference between CountDownLatch and CyclicBarrier

  • Talk about the Semaphore principle

  • Talk about the principle of Exchanger

  • Analysis of the principle of ThreadLocal, why does OOM appear in ThreadLocal, and the underlying principle

  • Talk about the implementation principle of thread pool

  • Several implementations of thread pools

  • The life cycle of the thread, how the state is transferred

  • Reference: " Java Multithreaded Programming Core Technology "

1.4, lock mechanism

  • Talk about thread safety, what is thread safety, how to ensure thread safety

  • The concept of reentrant locks, why can reentrant locks prevent deadlocks

  • Four conditions for deadlock (mutual exclusion, request and hold, no preemption, circular wait)

  • How to check for deadlock (check deadlock via jConsole)

  • volatile implementation principle (forbid instruction rearrangement, refresh memory)

  • Synchronized implementation principle (object monitor)

  • The difference between synchronized and lock

  • AQS synchronization queue

  • CAS lock-free concept, optimistic locking and pessimistic locking

  • Common atomic operation classes

  • What is the ABA problem and how does the JDK solve the ABA problem

  • Business scenarios and implementation methods of optimistic locking

  • Common concurrency classes under the Java 8 parallel package

  • The concept of bias lock, lightweight lock, heavyweight lock, spin lock

  • Reference: " Java Multithreaded Programming Core Technology "

1.5、JVM

  • JVM runtime memory area division

  • Examples and causes of memory overflow OOM and stack overflow SOE, how to troubleshoot and solve them

  • How to tell if an object is recyclable or alive

  • Common GC recovery algorithms and their meanings

  • Common JVM performance monitoring and troubleshooting tools: jps, jstat, jmap, jinfo, jconsole, etc.

  • How JVM sets parameters

  • JVM performance tuning

  • Class loaders, the parent delegation model, the life cycle of a class, how classes are loaded into the JVM

  • The process of class loading: loading, verification, preparation, parsing, initialization

  • Strong reference, soft reference, weak reference, phantom reference

  • Java Memory Model JMM

1.6. Design Patterns

  • common design patterns

  • The Six Principles of Design Patterns and Their Meanings

  • Common singleton patterns and the advantages and disadvantages of various implementations, which one is the best, handwritten common simple interest patterns

  • Application of Design Patterns in Actual Scenarios

  • What design patterns are used in Spring

  • What design patterns are used in MyBatis

  • What design patterns are used in your project

  • Talk about the analysis of the use of design patterns in common open source frameworks

  • Dynamic proxies are important! ! !

1.7, data structure

  • Trees (binary search trees, balanced binary trees, red-black trees, B-trees, B+ trees)

  • Depth-limited algorithm, breadth-first algorithm

  • Kruskal's Algorithm, Prinmo's Algorithm, Diclas' Algorithm

  • What is consistent Hash and its principle, Hash ring problem

  • Common sorting algorithms and search algorithms: quick sort, halved search, heap sort, etc.

1. 8. Network/IO Basics

  • Concepts of BIO, NIO, and AIO

  • What are long and short connections

  • What is the difference between Http1.0 and 2.0, please refer to " Http 2.0 "

  • Basic Concepts of HTTPS

  • Three handshakes and four waves, why do you need four waves

  • What happens from entering the URL in the browser until the page loads? Refer to " What Happens From Entering URL to Page Loading "

2. Data storage and message queue

2.1. Database

  • Notes on using MySQL indexes

  • What do DDL, DML, and DCL refer to?

  • explain command

  • left join,right join,inner join

  • Database Transaction ACID (Atomicity, Consistency, Isolation, Durability)

  • The isolation level of the transaction (read uncommitted, read committed, repeatable read, serializable read)

  • Dirty reads, phantom reads, non-repeatable reads

  • Several paradigms of the database

  • Common database commands

  • Talk about sub-library and sub-table design

  • Distributed dilemma and countermeasures brought by sub-database and sub-table (how to solve sub-database and sub-table under distributed, global table?)

  • Talk about SQL optimization

  • Deadlock problems encountered by MySQL, how to troubleshoot and solve them

  • The difference between the storage engine InnoDB and MyISAM, advantages and disadvantages, usage scenarios

  • Index category (B+ tree index, full-text index, hash index), the principle of index

  • What is Adaptive Hash Index (AHI)

  • Why use B+tree as the data structure of MySQL index

  • Difference between clustered index and non-clustered index

  • Have you ever encountered an index failure, when might it appear, and how to solve it

  • limit 20000 loading is very slow how to solve

  • How to choose a suitable distributed primary key scheme

  • Choose the right data storage solution

  • Several common distributed ID design schemes

  • Common database optimization solutions, how to optimize the database in your project

2.2、Redis

2.3, message queue

  • Usage scenarios for message queues

  • Message retransmission compensation solution

  • The idempotent solution of messages

  • message stacking solution

  • How to implement a message queue yourself

  • How to ensure the order of messages

3. Open source frameworks and containers

3.1、SSM/Servlet

  • Servlet life cycle

  • The difference between forwarding and redirecting

  • What is the difference between BeanFactory and ApplicationContext

  • Spring Bean life cycle

  • How Spring IOC is implemented

  • The scope of beans in Spring, which is the default

  • Talk about the implementation principle of Spring AOP and Spring AOP

  • Dynamic proxy (CGLib and JDK), advantages and disadvantages, performance comparison, how to choose

  • Spring transaction implementation, transaction propagation mechanism, default transaction category

  • The underlying principle of Spring transaction

  • Spring transaction failure (transaction nesting), the pit buried by JDK dynamic proxy for Spring transaction, please refer to "The pit buried by JDK dynamic proxy for Spring transaction!

  • How to customize the annotation implementation function

  • Spring MVC running process

  • Spring MVC startup process

  • Spring's singleton implementation principle

  • What design patterns are used in the Spring framework

  • Spring other products (Srping Boot, Spring Cloud, Spring Security, Spring Data, Spring AMQP, etc.)

  • Have you used Spring Boot? The understanding and principle of Spring Boot

  • The principle of MyBatis

  • Refer to " Why Spring "

  • Refer to " Why Spring AOP "

3.2、Netty

  • Why choose Netty

  • Talk about the usage scenarios of Netty in business

  • Native NIO has an epoll bug in JDK 1.7

  • What is TCP sticking/unpacking

  • The solution to TCP sticking/unpacking

  • Netty threading model

  • Talk about Netty's zero copy

  • Netty internal execution process

  • Netty reconnection implementation

3.3、Tomcat

4. Distributed

4.1、Nginx

  • Please explain what is C10K problem or know what is C10K problem?

  • For an introduction to Nginx, please refer to " Introduction to Nginx "

  • Forward proxy and reverse proxy.

  • Several common load balancing strategies for Nginx

  • What are the Master and Worker processes on the Nginx server?

  • What are the advantages of using a "reverse proxy server"?

4.2. Distributed others

  • Talk about the use of distributed scenarios in business

  • Session distributed solution

  • Session distributed processing

  • Application scenarios of distributed locks, causes of distributed locks, and basic concepts

  • Distribution is a common solution to locks

  • Common Solutions for Distributed Transactions

  • Algorithms and Implementations of Clustering and Load Balancing

  • To talk about the design of sub-database and sub-table, please refer to " Specific Implementation Plan of Database Sub-database and Sub-table Strategy "

  • Distributed dilemma and countermeasures brought by sub-database and sub-table

4.3、Dubbo

  • What is Dubbo, please refer to " Introduction to Dubbo "

  • What is RPC, how to implement RPC, and the implementation principle of RPC, please refer to " RPC Implementation Based on HTTP "

  • What is the concept of SPI in Dubbo

  • The basic principle and execution process of Dubbo

5. Microservices

5.1. Microservices

  • How is the front-end and back-end separation done?

  • Which frameworks are microservices

  • What are the common components of Spring Could? Refer to " Spring Cloud Overview "

  • Do you understand domain-driven? What is Domain Driven Model? Congestion model, anemia model

  • Do you know about JWT? What is JWT? Please refer to "JWT of Front-End Separation Tool "

  • How do you understand RESTful

  • Talk about how to design a good API

  • How to understand the idempotency of RESTful APIs

  • How to ensure the idempotency of interfaces

  • Talk about CAP theorem and BASE theory

  • How to Consider Data Consistency

  • Talk about the implementation of eventual consistency

  • For the advantages and disadvantages of microservices, please refer to " Microservice Criticism "

  • Difference Between Microservices and SOA

  • How to split services, split horizontally, split vertically

  • How to deal with chain call exceptions of microservices

  • How to fast track and locate problems

  • How to ensure the security and authentication of microservices

5.2, security issues

  • How to prevent common web attacks and SQL injection

  • Server communication security attack and defense

  • Analysis of HTTPS principle, downgrade attack, comparison of HTTP and HTTPS

5.3, performance optimization

  • What are the performance indicators

  • How to spot performance bottlenecks

  • Common means of performance tuning

  • Talk about how you perform performance tuning in your project

6. Others

6.1. Design ability

6.2. Business engineering

  • Talk about your development process and how to automate deployment

  • How you communicate with your team

  • How do you conduct code reviews

  • Tell us about your understanding of technology and business

  • Talk about the most difficult bug you encountered in the project and how to solve it

  • Introduce a project in your work that you think is the most valuable, as well as your role in the process, the problems solved, and what you think your project is lacking

6.3. Soft power

  • Tell us about your strengths and weaknesses

  • Tell me what book, what blog, what new technology you are researching recently, and then look at the source code of those open source projects

  • Tell me about the technical books you find most meaningful

  • What do you do in your spare time, how do you usually study, and how do you improve your abilities?

  • Discuss about the direction of personal development

  • Tell us what skills you think a server developer should have

  • Tell us what you think an architect is like and what an architect mainly does

  • How to deal with overtime

  • Welcome to leave a message to discuss the above problems! What are the frequently asked interview questions are also welcome to leave a message to add!

If you feel that you have something to gain, you can click on the collection and forward it. I specially organized it. There are many questions that cannot be explained clearly in a few words, so I simply asked a friend to record some videos to answer these interview questions. The answers to many questions are actually very simple, but the thinking and logic behind them are not simple. If you want to get these videos, you can add my Java architecture group: 725633148 , there are Ali Daniel in the group, and there are various Java distributed, JVM, multi-threading and other technical videos to share with you for free.

There will be updates in the future, so stay tuned! 

Guess you like

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