In order to go to top Internet companies such as Baidu, Ali, Tencent, Meituan, 58, Cheetah, Netease, Sina, Sohu, etc., I spent a long time sorting out these questions that are often asked in interviews. I believe I am familiar with these lists. The knowledge points will greatly increase the probability of passing the first two rounds of technical interviews. Now share it, I hope it will be helpful to everyone in the interview and daily work!
Due to limited space, only part of the interview questions are shown here. Friends who need answer analysis and more interview-related materials can click the link below to get them for free!
Link: Click here! ! ! Password: CSDN
1. Java basic interview knowledge points
The difference between == and equals and hashCode in java
How many bytes does int, char, and long occupy
The difference between int and integer
Tan Tan's understanding of java polymorphism
String、StringBuffer、StringBuilder区别
What is an inner class? The role of inner classes
The difference between abstract class and interface
The meaning of abstract classes
Application scenarios of abstract classes and interfaces
Can an abstract class have no methods and attributes?
The meaning of the interface
The difference between extends and super in generics
Can the static method of the parent class be overridden by the child class
The difference between process and thread
The difference between final, finally, finalize
Serialization method
The difference between Serializable and Parcelable
Can static properties and static methods be inherited? Can it be rewritten? And why?
Design intent of static inner classes
Understanding of member inner classes, static inner classes, local inner classes, and anonymous inner classes, as well as the application in the project
Talk about the understanding of kotlin
The difference between closure and local inner class
The way and principle of converting string to integer
Two. java in-depth interview questions
Under what circumstances will objects be disposed of by the garbage collection mechanism?
Tell me about common encoding methods?
How many bytes does Chinese in utf-8 encoding occupy; how many bytes does int type?
What is the difference between static proxy and dynamic proxy, in what scenarios?
Java's exception system
Talk about your understanding of resolution and dispatch.
Modify the signature of the equals method of object A, then when using HashMap to store this object instance, which equals method will be called?
What is the mechanism of polymorphism in Java?
How to serialize a Java object into a file?
Talk about your understanding of Java reflection
Talk about your understanding of Java annotations
Talk about your understanding of dependency injection
Talk about the principle of generics and give examples
Understanding of String in Java
Why should String be designed to be immutable?
Override the equal and hashCode methods of the Object class. Why?
Three. Data structure
Introduction to common data structures
What do you know about concurrent collections?
List java collections and the inheritance relationship between collections
Collection class and collection framework
Introduction to container classes and the difference between them (container classes are estimated to be unheard of by many people. Java containers can be divided into 4 parts: List list, Set collection, Map mapping, tool class (Iterator iterator, Enumeration enumeration class, Arrays and Collections), see this blog post Java container class for details)
The difference between List, Set, Map
Implementation and storage methods of List and Map
The realization principle of HashMap
HashMap data structure?
HashMap source code understanding
How to put data in HashMap (from the perspective of HashMap source code)?
How to implement HashMap by hand?
The realization principle of ConcurrentHashMap
Comparison of ArrayMap and HashMap
HashTable implementation principle
TreeMap implementation
The difference between HashMap and HashTable
The difference between HashMap and HashSet
How do HashSet and HashMap determine that the set elements are duplicated?
How to prevent collisions when implementing Hash in Set
The difference between ArrayList and LinkedList, and application scenarios
The difference between array and linked list
Specific implementation of depth-first traversal and breadth-first traversal of binary trees
Heap structure
The difference between heap and tree
What is the difference between heap and stack in memory (answer hint: you can answer from two aspects: data structure and actual implementation)?
What is deep copy and shallow copy
Handwritten linked list reverse code
Talk about the understanding of trees, B+ trees
Talk about the understanding of the graph
Determine whether the singly linked list is a ring or not?
Linked list flip (ie: flip a single necklace table)
Merge multiple singly ordered linked lists (assuming that they are all increasing)
Four. Thread, multi-thread and thread pool
Three ways to start threads?
The difference between thread and process?
Why use threads instead of just processes?
The difference between run() and start() methods
How to control the number of threads that a method allows concurrent access to?
The difference between wait and seelp methods in Java;
Talk about the understanding of wait/notify keywords
What causes thread blocking?
How to close the thread?
Talk about the synchronization method in java
How to ensure data consistency?
How to ensure thread safety?
How to achieve thread synchronization?
Can two processes require writing or reading at the same time? How to prevent process synchronization?
List of operations between threads
The life cycle of objects in Java
Synchronized usage
Principle of synchronize
Talk about the understanding of Synchronized keywords, class locks, method locks, and reentry locks
Multithreaded access and function of static synchronized method
Two synchronized methods in the same class, the problem of simultaneous access by two threads
The principle of volatile
Talk about the usage of volatile keyword
Talk about the role of volatile keyword
Talk about the understanding of NIO
The difference between synchronized and volatile keywords
The difference between synchronized and Lock
Comparison of ReentrantLock, synchronized and volatile
Internal implementation of ReentrantLock
lock principle
Four necessary conditions for deadlock?
How to avoid deadlock?
Will object locks and class locks affect each other?
What is a thread pool and how to use it?
Java's concurrency, multithreading, threading model
Talk about the understanding of multithreading
What are the issues to pay attention to in multithreading?
Talk about your understanding of concurrent programming and give examples
Talk about your understanding of multi-thread synchronization mechanism?
How to ensure the safety of multithreading to read and write files?
Multi-threaded breakpoint resumable transfer principle
Realization of Resumable Transmission
Five. Algorithm
What are the sorting algorithms?
Which is the fastest sorting algorithm?
Handwriting a bubble sort
Handwritten quick sort code
Quick sort process, time complexity, space complexity
Handwritten heap sort
Heap sorting process, time complexity and space complexity
Write down the sorting algorithm you know, its complexity and stability
Binary tree gives root node and target node, find the path from root node to target node
Which algorithm should be chosen to sort Ali's more than 20,000 employees by age?
GC algorithm (the advantages and disadvantages of various algorithms and application scenarios)
Ant Colony Algorithm and Monte Carlo Algorithm
Substring inclusion problem (KMP algorithm) write code to achieve
An unordered, non-repeating array, outputs N elements, so that the sum of N elements is added to M, giving time complexity and space complexity. Handwriting algorithm
Two trillion-level URL files A and B, how to find the difference C of A and B (hint: Bit mapping -> hash grouping -> multi-file read and write efficiency -> disk addressing and application-level addressing optimization)
Six. Database related
What are the characteristics of MySQL InnoDB and Mysaim?
The difference between optimistic lock and pessimistic lock?
What is the database isolation level? what's the effect?
The basic principle of MySQL master-slave synchronization.
Select * from table t where size> 10 group by size order by size SQL statement execution order?
How to optimize database performance (index, sub-database and table, batch operation, paging algorithm, upgrade hard disk SSD, business optimization, master-slave deployment)
Under what circumstances will SQL not use indexes (exclude, not equal, function)
What field is generally indexed on (the field with the most filtered data)
How to find all rows whose name field does not contain "XYZ" from a table?
MySQL, B+ index implementation, row lock implementation, SQL optimization
Redis, RDB and AOF, how to make high availability, cluster
How to solve the problem of high concurrency and inventory reduction
Implementation mechanism of indexes in mysql storage engine;
Several granularities of database transactions;
Row lock, table lock; optimistic lock, pessimistic lock
Seven. Redis and other cache system middleware
List a common concurrency model for Redis clients.
How does HBase implement fuzzy query?
Enumerate a commonly used message middleware, how to realize the order if the message is to be preserved?
How to implement a Hashtable? How does your design consider Hash conflicts? How to optimize?
Distributed cache, consistent hash
LRU algorithm, slab allocation, how to reduce memory fragmentation
How to solve the problem of single-machine caching hot spots
What is a Bloom filter, and its implementation principle? What does false positive mean?
The difference between memcache and redis
What are the functions of zookeeper and how is the election algorithm performed?
Map/reduce process, how to use map/reduce to achieve joint statistics of two data sources
At last
In order to help everyone better interview and study, here is a complete set of video tutorials for architects and systematic materials on java. From Javase-ssm-springcloud, including java core knowledge points, interview topics and 20 years of the latest Internet There are real questions, e-books, etc., which are very useful for friends and college students who want to learn Java or want to change careers. They are free to share with everyone~ Friends in need can click the link below to get them for free!
Link: Click here! ! ! Password: CSDN