2020 the last Java interview, I went to Kuaishou. The interview of kuaishou is very challenging, but also very interesting, I feel that I can ask about everything. (The second interview was scheduled 10 days ago, almost forgot) and then the HR interview, I received the offer the day before yesterday.

I forgot the details of the first and second interviews, so I just want to summarize

1 basis

  • Why is there only value passing in Java?
  • Int scope? Float range?
  • What is the relationship between hashCode and equals?
  • What is the difference between String StringBuffer and StringBuilder? Why is String immutable?
  • What if there are fields in Java serialization that you don’t want to serialize?
  • Can the Constructor be override?
  • Java exception Architecture? RuntimeException Exception Error for common examples
  • What’s the difference between a character constant and a string constant?
  • The subclass constructor is called before the subclass constructor is called.

2 set

Let’s take a look at the implementation of 1.8, which is quite different from 1.7

  • What’s the difference between ArrayList and linkedList?
  • How is the heap stored and where are the inserts?
  • What is the difference between HashMap and HashTable? Let’s talk about how hashMap works. Can a hashMap be read concurrently? What’s wrong with concurrent writing?
  • The collection classes are stored in the java.util package. How many interfaces do they have?
  • How is an Array different from an ArrayList? Let’s talk a little bit about how ArrayList is implemented, how to add, how to evaluate, and when to expand.
  • Tell me about ConcurrentHashMap? Head or tail? How to expand capacity?
  • What happens when data is inserted or deleted during an iteration of the collection?

3 concurrent

  • What’s the difference between notify() and notifyAll()?
  • What is volatile? Can order be guaranteed?
  • Why are wait, notify, and notifyAll not in thread?
  • What is the difference between SynchronizedMap and ConcurrentHashMap?
  • What is thread safety? Is Vector a thread-safe class?
  • Thread What is the difference between a process and a thread? What’s the difference between parallelism and concurrency? Know anything about coroutines? How processes communicate: What if process A wants to read main memory of process B? Interthread communication? What are the states of a thread’s life cycle? How to convert? What’s the difference between ‘wait’ and ‘sleep’? When is sleep used? How do I stop a thread? How to control the sequential execution of multiple threads?
  • Describe how you use the synchronized keyword. Did you use it in your project? There are three main ways to use the synchronized keyword
  • Why the join() method?
  • What is context switching in multithreading?
  • The difference between a deadlock and a live lock, a deadlock and starvation?
  • What is the thread scheduling algorithm used in Java?
  • What is atomic operation? What atomic classes are available in the Java Concurrency API?
  • What is a blocking queue? What is the implementation principle of blocking queues? How to implement producer-consumer using blocking queues
  • Model?
  • Does AQS know AQS? What are the underlying implementations of AQS? Talk about the underlying implementation of AtomicInteger
  • Why do we call the run() method when we call the start() method, and why can’t we call the run() method directly
  • Method?
  • How do you wake up a blocked thread in Java?
  • What is a thread group and why is it not recommended in Java?

4 IO

I’m not familiar with IO, so I didn’t say much

  • Know NIO? Tell me about
  • What is the difference between NIO and BIO?
  • Understand the Netty principle

JVM

1 Memory and GC

  • What is GC? Why GC?
  • JVM memory region distribution? Where does GC occur?
  • Can you guarantee GC execution?
  • How do I get memory used by Java programs? What percentage of the heap is used?
  • Describe the garbage collection process.
  • Understanding of garbage collection algorithms. What recycling algorithm is in use now?
  • When will FullGC trigger
  • What garbage collector is in use now? What do you know? Tell me about the G1
  • What is the relationship between container memory and JVM memory? How do I set the parameters?

2 Exceptions and tuning

  • What JVM parameter adjustments are on line?
  • Troubleshooting of oom faults
  • Online troubleshooting, suddenly did not respond for a long time, how to troubleshoot, OOM
  • How to check the CPU usage? General method? Location code? Why is the CPU high?
  • Frequent GC causes? When is FGC triggered?
  • How to obtain dump file? How do you analyze it?

Class 3 loaders

  • How do I implement my own class loader?
  • Class loading process?
  • Initialization order?

Spring

  • What are the main features of the different versions of the Spring Framework?
  • Talk about IOC and AOP
  • How does ioc prevent circular dependencies
  • Aop implementation principle, dynamic proxy process
  • Distinguish BeanFactory from ApplicationContext?
  • What is the lifecycle of the Spring Bean container?
  • What are the @autowired annotations for?
  • What are the ways to access Hibernate using Spring?
  • How does Spring process requests?

Redis

  • Why Redis/Why cache (high performance, high concurrency)
  • Redis common data structures and usage scenario analysis (String, Hash, List, Set, Sorted Set)
  • Redis common exceptions and solutions (cache penetration, cache avalanche, cache warming, cache degradation)
  • Common application scenarios in distributed environment (distributed lock, distributed auto-increment ID)
  • What should Redis cluster solution do? What are the options?
  • What is the master-slave replication model for Redis clusters?
  • Redis persistence mechanism (how to ensure that redis hangs and then restarts data can be recovered)
  • How to solve the Redis concurrent competing Key problem?
  • How to ensure data consistency between the cache and the database in dual write?
  • Redis zset usage scenarios? Underlying implementation? Why a skip watch?

MySQL

  • Concurrency of transactions? Transaction isolation levels, what problems are caused by each level, which level is MySQL’s default?
  • MySQL MyISAM and InnoDB two storage engines in, transaction, lock level, their applicable scenarios?
  • What locks (optimistic locks pessimistic locks), select how to add an exclusive lock?
  • What type of index does the SQL query determine to create? How to optimize queries?
  • What is a temporary table and when does a temporary table drop?
  • Mysql dirty pages?
  • What are the strategies for sub-database sub-table? How do I make sure my ID is unique?
  • Non-relational database and relational database differences, advantages comparison?
  • Read/write separation, master-slave replication, master-slave replication analysis of databases
  • MySQL > select * from ‘MySQL’ where deadlock is determined
  • What are the recovery mechanisms for transactions in the event of a database crash (REDO and UNDO logs)?
  • Understanding UUID? Which GUID and Random algorithms do you know?
  • Select random ID, UUID, or auto-increment ID for primary key? Why is that? What is the impact of primary key ordered disorder on the database?
  • Master slave replication process? How does replication work? How to ensure strong consistency?

Kafka

  • What is the producer and consumer command line?
  • How does Kafka ensure data reliability?
  • Talk about how Kafka maintains consumption status tracking
  • Why do you need a messaging system? Can’t mysql meet the requirements?
  • What are the two conditions for Kafka to determine if a node is still alive?
  • There are three key differences between Kafka and traditional MQ messaging systems.
  • How can messages be consumed sequentially in a distributed (not stand-alone) Kafka scenario?
  • How does Kafka not consume duplicate data? For example, deduction, we can’t double deduction

network

  • What mechanisms do TCPTCP have to ensure reliability? How is congestion control implemented? How to handle too many close_wait? Why is this happening?
  • How about three handshakes, four waves?
  • What is keepalive for? Principle of Https? Know which HTTP status codes there are? What are HTTP request methods? What are the differences between put and POST implementations?
  • What is the difference between front and rear end separation and non-separation? What are the advantages and disadvantages of each?
  • What are the common Web attacks? Do you know anything about CSRF attacks?
  • What if Nginx reaches its limit? How to load balance nginx? DNS?
  • What are the algorithms for nGINx load balancing? What are their strengths and weaknesses?
  • Restful function? What are the advantages and disadvantages?
  • What is a CDN? What fields in the header are involved in caching? Cookie Session a little bit about HTML pages, how do they interact with the back end? What is the process? What components are involved? HTTP protocol, packet format?

Design patterns

  • What are design patterns? Do you use it in your code?
  • What is the singleton design pattern in Java? Write thread-safe singleton patterns in Java
  • What is the Observer design pattern in Java?
  • What is a decorator design pattern implemented in Java? Does it work at the object level or the class level?
  • Singletons For singletons, what implementations do you know? Why is double check needed to implement a lazy-loaded singleton double check lock?
  • What are the main benefits of using the factory model? Where is it used?

distributed

  • Which distributed components are most familiar to you? Talk about them briefly.
  • What does cap stand for? What does mysql satisfy in CAP?
  • How can distributed locks be implemented? What are the advantages and disadvantages of each?
  • What is a consistent hash? What data structure will you use to implement your own consistent hash?

Micro service

  • What are the advantages of microservices architecture?
  • What are the differences between monolithic, SOA and microservice architectures?
  • What is RPC? How do you achieve idempotency?
  • What is REST/RESTful and what is it used for?
  • What options are available in the configuration center? Apollo architecture? How to implement loaded data update without feeling?
  • What about the concept of circuit breakers? Fuse breaker principle? The token bucket? Fuse three state relationship?
  • Does the circuit breaker affect performance? Have you ever encountered a circuit breaker on the line? What happens if you don’t?

Algorithm problem

They’re basically asking about time complexity

  • What are the common sorting algorithms?
  • Handwritten quicksort, what is the time complexity of quicksort?
  • Is the fast sorting algorithm stable? What is stability?
  • Given a string of letters, find the length of the smallest string that does not contain repeating characters.
  • What is the worst time to weigh a bad coin in 9 coins?
  • Depth first, breadth first
  • Bracket matching, time complexity, space complexity
  • Merge sort of unidirectional linked lists
  • 1g size file, each line is the largest 16k words, limited memory 1m, statistics of the most frequent 100 words
  • Write 100 large numbers with decimals by hand

Do you have any questions? + Offer options?

  • Department positioning? Job responsibilities? What business are you doing now? Compensation and benefits?
  • What is the current offer situation? What is your own preference for these companies? What factors do you value most? What kind of team would you like to join?
  • What are your salary expectations? What is your current salary?
  • What’s your performance in the last year?

I would like to supplement my offer in the second half of 2020. In fact, I have received letters of intent from Meituan Architecture, Kuaishou Main APP, Ape Counseling Zebra, Tencent CSIG and so on. And I think the “practice” before the interview is very important, for example, my “naked face” in the early stage has simply wasted the interview opportunity of Ali, Ant, Byte, Shopee, etc. So, my advice to everyone here is to make sure that you are well prepared, otherwise you will delay the time of the interviewer and yourself, and you will not know what to do during the interview. After all, there is nothing in the belly!

Finally, I chose Kuaishou and prepared to work on next Monday. Everyone come on, job interview is everywhere, if you are not ready, I suggest that after the New Year to participate in the spring recruitment in advance approval is also good, but you can not waste this spare time, take good advantage of!

Speaking of here, finally come out to put a wave of welfare! I hope I can help you!

Poke this – get the code – dig gold

Remember: brush more!! Brush more questions!!

Before the algorithm is my bruise, the back hard gnawed a good long period of time just fill come back, the algorithm is the soul of programmer !!!!

Space is limited, the following can only share part of the resources screenshots!!

(1) Multithreading (represented by multithreading, in fact, organized a set of Notes on JAVA core architecture)

(2) Brush algorithm questions (and left god algorithm notes)

(3) Face book + real question analysis + corresponding related notes (very comprehensive)

(4) Video learning (part)

Ps: Video is a great choice when you feel stuck or tired

In fact, all the things I share above, we may be able to find it on the Internet (PS: there are a lot of books sorted out by themselves is not), but it will be a little trouble to sort it out, if there is a need, I can share it for free to you, but please remember to get the way: poke this – get the code – nuggets

Here, the last word: I wish you all the offer to get soft!!