JAVA based

  1. What are the basic data types in JAVA and how many bytes each takes up?
  2. Can the String class be inherited? Why?
  3. Stringbuffer StringBuilder.
  4. What’s the difference between ArrayList and LinkedList?
  5. Talk about the order in which classes are instantiated, like superclass static data, constructors, fields, subclass static data, constructors, fields, when new, the order in which they are executed.
  6. HashMap is thread safe, what are the maps used concurrently, what are their internal principles, such as storage, Hashcode, capacity expansion, default capacity, etc.
  7. JAVA8’s ConcurrentHashMap does not have a segmented lock, what is the question, if you design, how do you design.
  8. Are there any sequential Map implementation classes, and if so, how do they ensure that they are ordered?
  9. The difference between abstract classes and interfaces is that a class can inherit from multiple classes, an interface can inherit from multiple interfaces, and a class can implement multiple interfaces.
  10. What’s the difference between inheritance and aggregation?
  11. What are the IO models, what do you understand about NIO, how does it differ from BIO and AIO, and the REACTOR model.
  12. How reflection works, what are the three ways that reflection creates class instances.
  13. In reflection, class. forName is different from ClassLoader.
  14. Describe several implementation methods of dynamic proxy and describe their advantages and disadvantages.
  15. Differences between dynamic proxies and Cglib implementations.
  16. Why CGlib can be used to implement proxies for interfaces.
  17. The use of final.
  18. Write out three singleton pattern implementations.
  19. How do I automatically complete all hashCode and equals implementations for subclasses in a parent class? What are the pros and cons of this.
  20. Talk about the role of access modifiers public, private, protected, and default in application design in the context of OO design.
  21. Deep copy is different from shallow copy.
  22. Array and linked list data structure description, their time complexity.
  23. Error and Exception, CheckedException, RuntimeException.
  24. List five runtime exceptions.
  25. If you create a java.lang.String class in your own code, can that class be loaded by the class loader? Why.
  26. Describe your understanding of the hashCode and equals methods in java.lang.Object. Under what circumstances
  27. Both methods need to be reimplemented.
  28. In jdk1.5, generics were introduced to solve what problems generics exist to solve.
  29. What’s the use of this a.hashcode()?
  30. Is it possible that two objects that are not equal have the same Hashcode?
  31. How a HashSet in Java works internally.
  32. What is serialization, how to serialize, why serialization, deserialization will encounter what problems, how to solve.
  33. New features in java8.

The JVM knowledge

  1. What happens when a stack memory overflow occurs?
  2. JVM memory structure, Eden and Survivor ratio.
  3. JVM memory is divided into new generation, old generation, persistent generation. Why should the new generation be divided into Eden and Survivor?
  4. What is the complete GC flow in the JVM? How does an object progress to older generations? What are the main JVM parameters that you know of
  5. The number.
  6. You know which garbage collectors, their pros and cons, focus on CMS and G1, including principles, processes, and pros and cons.
  7. The realization principle of garbage collection algorithm.
  8. When there is an overflow of memory, how do you sort it out.
  9. Knowledge of the JVM memory model, such as reordering, memory barriers, happening-before, main memory, work
  10. Memory, etc.
  11. Tell me briefly what you know about classloaders, can they break parental delegation and how.
  12. Talk about Reflection in JAVA.
  13. What JVM parameters do you apply online?
  14. G1 and CMS differences, throughput first and response first garbage collector selection.
  15. How to print thread stack information.
  16. Please explain what the following JVM parameters mean:
  17. -server -Xms512m -Xmx512m -Xss1024K
  18. -XX:PermSize=256m -XX:MaxPermSize=512m –
  19. XX:MaxTenuringThreshold=20XX:CMSInitiatingOccupancyFraction=80 –
  20. XX: + UseCMSInitiatingOccupancyOnly.

Open source framework knowledge

  1. A brief introduction to the Tomcat structure, its classloader flow, threading model, and more.
  2. How tomcat is tuned and what parameters are involved.
  3. Talk about the Spring loading process.
  4. The implementation principle of Spring AOP.
  5. Talk about the propagation properties of Spring transactions.
  6. How Spring manages transactions.
  7. How Spring configures transactions (specify some key XML elements).
  8. What is your understanding of Spring? How does non-singleton injection work? Its life cycle? Cyclic injection principle, aop implementation of the original
  9. Let’s talk about a few terms in AOP and how they work with each other.
  10. Initialization of DispatcherServlet in Springmvc.
  11. Netty’s threading model, how netty is implemented based on the REACTOR model.
  12. Why netty?
  13. What is TCP sticky packet? Unpack. What is the solution.
  14. Usage of Netty’s FashwheelTimer, implementation principle, whether the call is not on time, how to solve.
  15. Netty heartbeat processing in the weak network how to do.
  16. What is the communication protocol of Netty?
  17. Springmvc uses annotations, what they do, how they work.
  18. Springboot boot mechanism.
  19. Click here for a Spring exam with answers.

The operating system

  1. What kernel parameters do you care about in Linux?
  2. There are several IO models in Linux.
  3. What’s the difference between epoll and poll?
  4. Which Linux commands do you use?
  5. Look at the last five lines of the file with one command.
  6. Output the running Java process with a single command.
  7. Introduce your understanding of thread switching in an operating system.
  8. The difference between processes and threads.
  9. What comes after the top command and what does it do?
  10. The online CPU is high. How do you find the problem?

multithreading

  1. Several ways to achieve multithreading, what is thread safety.
  2. How volatile works, how it works, and how it replaces locking.
  3. Draw a life cycle state diagram for a thread.
  4. The difference between “sleep” and “wait”.
  5. The difference between sleep and sleep(0).
  6. The difference between Lock and Synchronized
  7. What is the principle of synchronized, and where is it generally used (e.g. the difference between static and non-static methods, static
  8. Does it matter when static and non-static methods are executed simultaneously?), explain the terms: resort, spin lock, bias lock, light
  9. Weight lock, reentrant lock, fair lock, unfair lock, optimistic lock, pessimistic lock.
  10. Which atomic classes are used and how they work.
  11. What concurrency tools have been studied under JUC? Explain the principle.
  12. Have you used a thread pool? If so, explain how it works and what is the difference between newCache and newFixed
  13. What are the meanings of the various parameters of the number, such as coreSize, maxsize, etc.
  14. There are several ways to close a thread pool, and what are the differences?
  15. If you have a third-party interface that has many threads to call to fetch data, you can now specify a maximum of 10 lines per second
  16. Call it when, how to do.
  17. Is the spring controller singleton or multi-instance? How to ensure the safety of concurrency?
  18. Print the letters ABC in a sequence of three threads, such as abcabcabc.
  19. Have you used ThreadLocal before? What does it do? How does it work?
  20. What would you do if you were asked to implement a concurrency safe linked list?
  21. What lock-free data structures are there, and how they work.
  22. Talk about Java synchronization mechanisms wait and notify.
  23. What is CAS mechanism and how to solve ABA problem.
  24. Multithreading what happens if the thread hangs.
  25. The internals and uses of countdowlatch and CyclicBarrier, and the differences between them (e.g
  26. Countdownlatch ‘await’ method and how it is implemented.
  27. To understand AbstractQueuedSynchronizer, something about locking and unlocking process, an exclusive lock and fair
  28. What’s the difference with locking.
  29. What is the difference between using synchronized to modify static and non-static methods?
  30. Briefly describe the uses and differences of ConcurrentLinkedQueue and LinkedBlockingQueue.
  31. What causes thread deadlocks? How to unlock a thread deadlock.
  32. Many threads (possibly different machines) need to wait for coordination between each other to complete some kind of work.
  33. Have you used read/write lock? What is the principle? What is the general situation?
  34. If multiple threads are enabled, if sequential execution is guaranteed, what are the implementation methods, or how to ensure that multiple threads are completed
  35. And get the results.
  36. The implementation of delayQueue, delayQueue and time round algorithm similarities and differences.
  37. Click here for a set of multi-threaded questions with answers.

TCP and HTTP

  1. What’s the difference between HTTP1.0 and HTTP1.1?
  2. TCP three-way handshake and four-way wave. Why does it take four times to disconnect? What happens if there are only two handshakes?
  3. Difference between TIME_WAIT and CLOSE_WAIT
  4. Name several HTTP response codes you know, such as 200, 302, 404.
  5. What steps does the computer take when you open a link (such as www.javastack.cn) with your browser?
  6. How to ensure TCP/IP reliability, talk about the structure of the TCP header.
  7. How to avoid browser caching.
  8. How to understand the statelessness of HTTP protocol.
  9. This section describes the differences between GET and POST and the packet formats of Http requests.
  10. HTTP methods
  11. This section describes the format of HTTP request packets.
  12. HTTP long connection.
  13. What is the encryption method of HTTPS? Explain the whole encryption and decryption process.
  14. What’s the difference between Http and HTTPS’s three-way handshake?
  15. What is chunking?
  16. The difference between Session and cookie.
  17. Click here for a set of questions with answers.

Architectural design and distribution

  1. Implement an LRU yourself in Java.
  2. How to achieve unique sequence number in distributed cluster.
  3. Design a split-kill system that automatically closes transactions if no payment is made in 30 minutes.
  4. How to use Redis and ZooKeeper to implement distributed locks? What are the differences? What are the advantages and disadvantages? What are the problems
  5. Scenario. (Extension: If you know Redlock, talk about his algorithm implementation, where is the controversy?)
  6. What can I do if an invalid connection is created maliciously?
  7. The principle of distributed transaction, advantages and disadvantages, how to use distributed transaction, the difference between 2PC and 3PC, what problems solved, and
  8. What issues are not addressed, how are they addressed, and how are distributed transactions handled in your own projects?
  9. What is a consistent hash?
  10. What is restful? Tell me what you understand restful.
  11. How to design a good API.
  12. How to design and establish and maintain 100W long connections.
  13. Explain what the MESI protocol (cache consistency) is.
  14. Name some HASH algorithms you know, even simple ones.
  15. What is paxOS algorithm and what is ZAB protocol?
  16. In an online document system, documents can be edited. How do you prevent multiple people from working together at the same time
  17. A document for editing and updating.
  18. Online systems suddenly become incredibly slow, how do you find problems.
  19. Tell me about a design pattern you use.
  20. Dubbo principle, have read the source code, how data flow, how to achieve cluster, load balancing, service registration
  21. And what are the strategies for discovering, retrying forwarding, and failing fast.
  22. What is the flow of an RPC request?
  23. Have you implemented RPC? The principle can be explained briefly. What problem does Rpc solve?
  24. The purpose and significance of asynchronous patterns.
  25. How to consider some design principles in programming, such as the open and close principle, and the application in the work.
  26. Design a “private message” feature in a social networking site that requires high concurrency, scalability, etc. Draw the architecture diagram.
  27. The MVC pattern is the common MVC framework.
  28. I will talk about the server architecture I participated in designing and drawing, and the problems I met and how to solve them.
  29. How the application server monitors performance, the difference in various ways.
  30. How to design a high concurrency payment solution, how to design the architecture.
  31. How to achieve load balancing and what algorithms can be implemented.
  32. What Zookeeper is used for and how elections work.
  33. Mechanism of Zookeeper Watch.
  34. The underlying realization principle of Mybatis.
  35. Consider a solution to implement countDownLatch in a distributed environment.
  36. How does the backend system prevent requests from being submitted repeatedly?
  37. Describes the detailed process of a service from publication to consumption.
  38. Describe your understanding of service governance.
  39. How to make interfaces idempotent.
  40. How to do traffic limiting policy, the use of token bucket and funnel algorithm scenarios.
  41. What is data consistency? How do you understand data consistency?
  42. How does a distributed service caller, independent of the service provider, handle a large number of invalid resource requests when the service provider hangs up
  43. Waste, if only the service provider throughput is not high what to do, if the service is down, then later restart, what to do
  44. What is the realization mechanism of half-open flow to minimize resource waste?
  45. How dubbo’s generalization calls are implemented, and what you would do if it were you.
  46. Remote call will have timeout phenomenon, if you do elegant control, JDK built-in timeout mechanism what, how to implement.

algorithm

  1. Find the 10 smallest numbers in a billion.
  2. There are 100 million numbers, two of which are repeated, and find it quickly, in time and space.
  3. 200 million randomly generated, unordered integers, find the middle size of the value.
  4. Given an input string of unknown length (possibly large), devise a scheme for reweighting duplicate characters.
  5. Walk through the binary tree.
  6. There are 3n+1 numbers, 3n of which are repeated, and only 1 of which is not repeated.
  7. Write a string (e.g. www.javastack.cn) to reverse the function.
  8. Commonly used sorting algorithm, quick sorting, merge, bubble. The optimal time complexity and the worst complexity of fast sorting. Bubble sort
  9. Optimize the scheme.
  10. Time complexity of binary search, advantages.
  11. How to reverse sort a TreeSet that is already built.
  12. What are B+ trees, B- trees, list the actual usage scenarios.
  13. A one-way linked list, delete the last NTH data.
  14. 200 ordered arrays of 100 elements each, find the top20 elements.
  15. One-way linked list, looking for the element in the middle.

Database knowledge

  1. What are the database isolation levels, what are their meanings, and what is MYSQL’s default isolation level?
  2. What is illusory.
  3. What storage engines does MYSQL have?
  4. How to safely modify the same row of data under high concurrency.
  5. What are optimistic locks and pessimistic locks? What are INNODB’s standard row-level locks? Explain their meanings.
  6. What are the general steps of SQL optimization, how to look at the execution plan, and how to understand the meaning of each field in it?
  7. Mysql > mysql > deadlock > mysql > mysql > deadlock
  8. MYsql index principle, index types, how to create a reasonable index, index optimization.
  9. Differences between clustered and non-clustered indexes.
  10. Select for update, lock table, lock row, etc.
  11. Why Btree is implemented, how it splits, when it splits, and why it’s balanced.
  12. What is the ACID of the database?
  13. A table has nearly ten million data, CRUD is relatively slow, how to optimize.
  14. Mysql optimize table scan.
  15. How to write SQL to effectively use composite indexes.
  16. In and exists are different in mysql.
  17. Possible problem with database auto-increment primary key.
  18. What MVCC means and how it is implemented.
  19. Did you meet the sub-database sub-table in the project you have done, how to do it, is it useful for middleware, such as Sharding JDBC, he
  20. Do you know how they work?
  21. How to solve the primary/secondary delay of MYSQL?

The message queue

  1. Usage scenarios for message queues.
  2. Retransmission of messages, supplementary policies.
  3. How to ensure the order of messages.
  4. What MQS have you used, what are the advantages and disadvantages compared to other MQS, are MQ connections thread safe, your company’s MQ service
  5. What’s the architecture?
  6. How to ensure that data in the MQ system is not lost?
  7. How rabbitMQ implements cluster high availability.
  8. The reason for kafka’s high throughput.
  9. The difference between Kafka and other message queues is how kafka master slave synchronization is implemented.
  10. How to achieve final consistency with MQ.
  11. Have you encountered any problems with Kafka? What are the solutions?
  12. Repeated consumption of MQ may occur, how to avoid it, and how to achieve idempotent.
  13. MQ messages delayed how to deal with, can the message set expiration time, expired you generally how to deal with.

The cache

  1. What are the common cache strategies, and how to ensure that the cache (such as Redis) is consistent with the data in DB, which were used in your project
  2. What caching system? How it was designed.
  3. How to prevent cache crashes and avalanches.
  4. How to design updates to cache data after expiration.
  5. Redis list structure-related operations.
  6. What are the data structures of Redis?
  7. Redis: Persistence, memory Settings, clustering applications, advantages and disadvantages, elimination strategies, etc.
  8. The difference between REDIS2 and Redis3, redis3 internal communication mechanism.
  9. The current redis cluster has what gameplay, their advantages and disadvantages, scenarios.
  10. How Memcache works, what data fits in the cache.
  11. Memory management differences between Redis and memcached.
  12. How to solve the problem of Redis concurrency contention, understand the CAS operation of Redis transaction?
  13. What is the Redis election algorithm and process?
  14. Redis persistence mechanism, aOF and RDB difference.
  15. How the redis cluster synchronizes data.
  16. Know which redis optimization operations.
  17. Principle of master/slave replication mechanism for Reids.
  18. What is the thread model of Redis?
  19. Consider a scenario for designing an adaptive local cache that can control the overall size of the cache.
  20. How to view the use of caches (local caches, centralized caches), briefly describe the advantages and disadvantages of local and centralized caches.
  21. Precautions for concurrent use of local cache.

search

  1. The size of the index data, how many shards there are, and some
  2. Tune the means. What is the inverted index of ElasticSearch?
  3. Select * from elasticSearch; select * from elasticSearch;
  4. How does ElasticSearch implement master voting?
  5. Describe the process of indexing documents for Elasticsearch in detail.
  6. Describe the process of Elasticsearch in detail.
  7. What are the optimizations for Linux Settings when Elasticsearch is deployed?
  8. What is the internal structure of Lucence?

These are the most comprehensive Java interview questions, and the following are the latest summary of Java interview questions and answers.

2020 Latest BAT advanced Java interview questions and answers

Claim Method:

Please forward it and add assistant VX: Yunduoa2019 after following it or scan the qr code below and follow the guidance of the assistant to obtain it by yourself