Sorted out 136 Ali Java interview questions, all to challenge, see how good you are. The following questions have super detailed solutions, see the bottom for details.
Java based
- Arrays.sort and Collection
- Foreach vs. while (compiled)
- Types, differences, and usage scenarios of thread pools
- Analysis of thread pool implementation principle and thread scheduling process
- How can thread pools be tuned
- What determines the maximum number of threads in a thread pool
- Several ways of dynamic proxy
- Concurrency issues with HashMap
- Do you know anything about LinkedHashMap
- How does reflection work, what are the three ways that reflection creates class instances?
- Cloneable interface implementation principle, shallow copy or deep copy
- Java NIO use
- Hashmap can ask for array index. How to solve hash collision
- Arraylist and LinkedList differences and implementation principles
- In reflection, class. forName is different from ClassLoader
- What’s the difference between String, Stringbuffer, StringBuilder?
- Is it possible that two objects that are not equal have the same Hashcode
- Describe NIO best practices, such as Netty, Mina
- Implementation principles of TreeMap
The JVM related
- The order in which classes are instantiated, such as superclass static data, constructors, fields, subclass static data, constructors, fields, the order in which they are executed
- JVM memory generation
- Java 8 memory generation improvements
- JVM garbage collection mechanism, when to trigger MinorGC, etc
- What is a complete GC flow in the JVM (from YGC to FGC), focusing on how objects are advanced to the old age, the main JVM parameters, etc.
- You know which garbage collectors, their pros and cons, focus on CMS, G1
- New generation and old generation memory reclamation strategies
- Eden and Survivor ratio allocation, etc
- In-depth analysis of Classloader, parent delegation mechanism
- Compilation optimization for the JVM
- An understanding of the Java memory model and its application to concurrency
- Instruction reordering, memory fencing, etc
- OOM error, StackOverflow error, Permgen space error
- Common JVM parameters
- Tomcat structure, class loader flow
- The semantics of volatile. Are the variables it modiates thread-safe
- G1 and CMS differences, throughput first and response first garbage collector selection
- What do you understand about the environment variable CLASspath? Why does a class throw a ClassNotFoundException if it is not in the classpath, and how can it be loaded correctly without changing the classpath?
- Talk about strong references, soft references, weak references, virtual references and the relationship between them and GC
JUC/ concurrency related
- Have you used ThreadLocal before, how does it work, and what should you pay attention to when using it
- The difference between Synchronized and Lock
- Principle of synchronized, what is spin lock, bias lock, lightweight lock, what is reentrant lock, what is fair lock and unfair lock
- Concurrenthashmap implementation and its principle, jdK8 under the revision
- Which atomic classes have been used, and what are their parameters and principles
- What is CAS and what problems it can cause (ABA problem solving, such as adding number of changes, version number)
- If you were asked to implement a concurrency safe linked list, what would you do
- Briefly describe the uses and differences of ConcurrentLinkedQueue and LinkedBlockingQueue
- This section describes the implementation principle of AQS
- What are the uses of countdowlatch and cyclicbarrier, and the differences between them?
- What classes are used in the Concurrent package? In what scenario is it used? Why use it?
- LockSupport tools
- Condition interface and its implementation principle
- Understanding the Fork/Join framework
- ParallelStream for JDK8
- The principle of segmental lock, lock force reduced thinking
Spring
- Implementation principle of Spring AOP and IOC
- The difference between Spring’s beanFactory and factoryBean
- Why can CGlib be used to implement proxies for interfaces?
- RMI versus the proxy pattern
- Spring transaction isolation level, implementation principle
- Understanding of Spring, how does non-singleton injection work? Its life cycle? The principle of circular injection, the implementation principle of AOP, some terms in AOP, how do they work with each other?
- The underlying realization principle of Mybatis
- MVC framework, how do they do URL routing
- Spring Boot features, advantages, and application scenarios
- Quartz and Timer
- Is the Spring controller singleton or multi-instance? How to ensure concurrency security
Distributed correlation
- The underlying implementation principles and mechanisms of Dubbo
- Describes the detailed process of a service from publication to consumption
- How do distributed systems do service governance
- The concept of idempotency of interfaces
- How does messaging middleware solve message loss
- Dubbo service request failed
- Does the reconnection mechanism cause errors
- Understanding of distributed transactions
- How to achieve load balancing and what algorithms can be used to achieve it?
- What is the purpose of Zookeeper and how does election work?
- Vertical split of data Horizontal split.
- Zookeeper principles and application scenarios
- They watch mechanism
- How can I handle the redis/ ZK node failure
- How to achieve unique sequence number in distributed cluster
- How to make a distributed lock
- What MQ has been used, how has it been used, how does it compare to other MQS, and is the connection to MQ thread-safe
- How is the data of the MQ system guaranteed against loss
- List all the strategies you can think of for separating databases from tables; How to solve the problem of query of whole table after dividing database and table.
Algorithms and data structures and design patterns
- Massive URL reclassification problem (Bloom filter)
- Array and linked list data structure description, their time complexity
- Binary tree traversal
- Quick sort
- Operations related to BTree
- What design patterns have you encountered in your work and how have you applied them
- What hash algorithms are used, advantages and disadvantages, and application scenarios
- What is a consistent hash
- Paxos algorithm
- How do you choose between decorator mode and proxy mode
- The steps and reasons for code refactoring, and how to understand refactoring to patterns?
The database
- MySQL InnoDB storage file structure
- How is the index tree maintained?
- Possible problem with database auto-increment primary key
- MySQL optimization
- Why use B+ tree for mysql index
- Database lock table related processing
- Index Failure Scenario
- How to safely modify the same row under high concurrency? What are optimistic locks and pessimistic locks? What are INNODB row-level locks
- Mysql > database deadlocks
Redis is related to caching
- How to solve the Redis concurrency race problem Understand the CAS operation of Redis transactions
- How to minimize the impact of the cache machine on the system, the implementation of consistent hash
- What are the advantages and disadvantages of Redis persistence? How to implement it
- Redis cache invalidation policy
- Workaround for cache penetration
- Redis cluster, high availability, principle
- MySQL has 2000W data, redis only 20W data, how to ensure that the data in Redis is hot data
- With Redis and any language to achieve a malicious login protection code, limit 1 hour per user Id can only login 5 times
- Redis’ data obsolescence strategy
Network related
- What is the difference between HTTP1.0 and HTTP1.1
- TCP/IP protocol
- TCP three-way handshake and four-way wave process, why disconnection takes four times, if there are only two handshakes, what happens
- Difference between TIME_WAIT and CLOSE_WAIT
- Name some HTTP response codes you know
- What steps does the computer take when you open a link with a browser
- How does TCP/IP ensure reliability and what data packets consist of
- Long connection and short connection
- Http request get and POST differences and packet format
- Briefly describes the process of TCP three-way handshake for establishing a connection and four-way handshake for disconnecting a connection. What is the cause of excessive TIMEWAIT when closing a connection? Is it active or passive?
other
- Maven resolves dependency conflicts, the difference between snapshot releases and distributions
- There are several IO models in Linux. What are their meanings
- Actual scenario Q: How do I sort massive login logs and process SQL operations, mainly the application of index and aggregation functions
- Actual scenario problem solving, typical TOP K problem
- Online bug handling process
- How do I find problems from online logs
- What commands does Linux use to find out what went wrong (e.g., IO intensive tasks, excessive CPU)?
- Scenario problem, there is a third party interface, there are many threads to call the data, now specify a maximum of 10 threads per second to call it at the same time, how to do it.
- Print the letters ABC in a sequence of three threads, such as abcabcabc.
- What are the common caching strategies, what is the caching system used in your project, and how is it designed
- Design a seckill system that automatically closes transactions if no payment is made in 30 minutes (concurrency is high)
- List the performance testing tools you know
- How does the backend system prevent requests from being submitted repeatedly?
conclusion
Summarizes some experience in the previous interview experience, actually when you interview to a relatively high level position, often fight technology is second, most companies after chatting with you technology, more weight is given to your communication skills, problem solving skills, as well as some of the more successful your past experiences.
Ready for an interview is not just these not only including technology, as well as your understanding of the company, this is in the hr this pass on, they want to find the Montana is not only technology, more important is can make progress together with company’s partners, so when you actually start to interview, then come up with their own sincere, let the hr feel you to the company’s interest, enthusiasm and confidence, Speaking decisively and firmly is often preferred by many recruiters. If you are interested in a certain company and technology, customs clearance, so how to make the company in the multiple choice to choose you, that is to make the hr in communication with you feel happy and smooth, this is very important, a lot of people can be qualified for a job, but can be a notch above in communication, the job should be is belong to you!
Finally, based on the above frequently asked interview questions, I also summarized most of the interview questions and answers involved in the interview of Java programmers in major Internet companies into a document, study notes and architecture video materials free to share with everyone (including Dubbo, Redis, Netty, ZooKeeper, Spring Cloud, distributed, high concurrency and other architecture technology information), I hope to help you review before the interview and find a good job, but also save the time to study on the Internet to search for information, you can also pay attention to me later will have more dry goods to share.
Data acquisition:
Review the bible
(1) Java interview Manual
- Performance optimization interview column
- Microservices Architecture interview column
- Advanced Interview column for Concurrent programming
- Open source framework interview questions column
- Distributed Interview
(2) Actual combat documents
- Redis of actual combat
- MySQL of actual combat
- Spring the Boot of actual combat
- Spring Cloud of actual combat
- Actual Java virtual machine
The actual Java VM is used as an example:
- An introduction to the Java VIRTUAL machine
- Understand the basic structure of Java virtual machines (VMS)
- Common Java VIRTUAL machine parameters
- Garbage collection concepts and algorithms
- Garbage collector and memory allocation
- Performance Monitoring tool
- Analysis of the Java heap
- Locking and concurrency
- Class file structure
- Class loading system
- Bytecode execution
(3) Java core knowledge points sorted out documents
Due to the limitation of space, many contents only show catalog and screenshots, which are organized in the document, need these documents, can be shared with you for free, I hope all programmers can learn up, and strive to achieve our dream of Dachang!
Data acquisition: