Recently, I have received many private letters from fans, including those who have worked for several years and those who are about to graduate. They all came to tell me that the golden nine silver ten is coming soon. They want to go to interview a wave of big factories and ask me if I have related interview questions to share. After hearing that, I also quickly sorted out a copy for you. I don’t have to say much. The full dry goods are below. Friendly tips. The article is full of dry goods. Watch it slowly!!! (the answers are arranged at the end of the article)
Multithreading, concurrency and basic problems of threads
1) Can you create volatile array in Java?
2) Can volatile make a nonatomic operation atomic?
3) What is the practice of volatile modifier?
4) What guarantees do volatile type variables provide?
5) 10 threads and 2 threads of synchronization code, which is easier to write?
6) How do you call the wait () method? Use if block or loop? Why?
7) What is false sharing in multithreading environment?
8) What is busy spin? Why do we use it?
9) How to get a thread dump file in Java?
10) Is swing thread safe?
11) What are thread local variables?
12) Write a code with wait notify to solve the producer consumer problem?
13) Write a thread safe singleton in Java?
14) The difference between sleep method and wait method in Java?
15) What is immutable object? How to create an immutable object in Java?
16) Can we create an immutable object that contains mutable objects?
Data type and java basic interview questions
17) What data type should be used in Java to represent price?
18) How to convert byte to string?
19) How to convert bytes to long type in Java?
20) Can we cast int to a byte type variable? What happens if the value is larger than the range of byte type?
21) there are two classes, B inherits a and C inherits B. can we convert B to C? If C = (c) B;
22) which class contains the clone method? Cloneable or object?
23) are + + operators thread safe in Java?
24) the difference between a = a + B and a + = b
25) can I assign a double value to a long variable without coercion?
26) 3 * 0.1 = = 0.3 what will be returned? True or false?
27) which will occupy more memory, int or integer?
28) why is string immutable in Java?
29) can we use string in switch?
30) what is the constructor chain in Java?
Interview questions between JVM bottom layer and GC (garbage collection)
31) in 64 bit JVM, the length of int is majority?
32) what are the differences between serial and parallel GC?
33) for 32-bit and 64 bit JVMs, the length of int type variables is majority?
34) what is the difference between WeakReference and softreference in Java?
35) how does weakhashmap work?
36) what is the function of JVM option – XX: + usecompersedoops? Why use it?
37) how to judge whether the JVM is 32-bit or 64 bit by Java program?
38) what is the maximum heap memory of 32-bit JVM and 64 bit JVM?
39) what are the differences among JRE, JDK, JVM and JIT?
Java interview questions for 3 years of work experience
40) explain Java heap space and GC?
The interview questions and answers of the bottom layer of JVM
41) can you guarantee GC implementation?
42) how to get the memory used by Java program? Percentage of heap usage?
43) what is the difference between heap and stack in Java?
Interview questions and answers about memory
Java basic concepts interview questions
What is the difference between “a = = B” and “a.equals (b)”?
45) what’s the use of A. hashcode()? What does it have to do with A. equals (b)?
46) what are the differences between final, finalize and finally?
47) what are compile time constants in Java? What are the risks of using it?
Interview questions based on Java set framework
This part also includes data structure, algorithm and array
48) differences among list, set, map and queue
49) the difference between the poll () method and the remove () method?
50) what is the difference between LinkedHashMap and PriorityQueue in Java?
51) what is the difference between ArrayList and LinkedList?
52) what are the two ways to sort sets?
53) how to print arrays in Java?
54) is the LinkedList in java a one-way linked list or a two-way linked list?
55) what tree is used to implement treemap in Java?
56) what is the difference between hashtable and HashMap?
57) how does HashSet work internally in Java?
58) write a piece of code to remove an element when traversing ArrayList?
59) can we write a container class ourselves and then use the for each loop code?
60) the default size of ArrayList and HashMap is majority?
61) is it possible that two unequal objects have the same hashcode?
62) do two identical objects have different hash codes?
63) can we use random numbers in hashcode()?
64) what is the difference between comparator and comparable in Java?
65) why rewrite the hashcode method when rewriting the equals method?
Interview questions of Java IO and NiO
IO is a very important point in Java interview. You should have a good command of Java IO, NiO, nio2 and the basic knowledge related to operating system and disk IO. Here are some frequently asked questions in Java io.
66) in my java program, I have three sockets. How many threads do I need to process them?
67) how to create ByteBuffer in Java?
68) how to read and write ByteBuffer in Java?
69) is java big end or small end?
70) what is the byte order in ByteBuffer?
71) in Java, what is the difference between direct buffer and indirect buffer?
72) what is the memory mapped cache in Java?
73) what does the socket option TCP no delay mean?
74) what is the difference between TCP and UDP?
75) in Java, what is the difference between ByteBuffer and StringBuffer?
Interview questions of Java best practices
Contains best practices for various parts of Java, such as collections, strings, IO, multithreading, error and exception handling, design patterns, and so on.
76) in Java, what best practices do you follow when writing multithreaded programs?
77) describe some best practices for using collections in Java
78) name at least five best practices for using threads in Java.
79) name 5 IO best practices
80) list five JDBC best practices to follow
81) how many best practices for method overloading in Java?
Interview questions for date, time and calendar
82) is simpledateformat thread safe in a multithreaded environment?
83) how to format a date in Java? For example, format as ddmmyyyy?
84) in Java, how to display the time zone in the formatted date?
85) in Java java.util.Date And java.sql.Date What’s the difference?
86) in Java, how to calculate the difference between two dates?
87) in Java, how to convert the string yyyymmdd to date?
Unit test JUnit interview questions
89) how to test static methods?
90) how to use JUnit to test the exception of a method?
91) which unit test library have you used to test your Java program?
What’s the difference between @ before and @ beforeclass?
Programming and code related interview questions
93) how to check that a string contains only numbers?
94) how to use generics to write an LRU cache in Java?
95) write a java program to convert byte to long?
95) how to reverse a string without using StringBuffer?
97) in Java, how to get the highest frequency of words in a file?
98) how to check that two given strings are in reverse order?
99) in Java, how to print out all permutations of a string?
100) in Java, how to print out the repeated elements in the array?
101) how to convert a string to an integer in Java?
102) how to exchange the values of two integer variables without using temporary variables?
Interview questions about OOP and design pattern
This part contains the design principles of solid, the basis of OOP, such as class, object, interface, inheritance, polymorphism, encapsulation, abstraction and some more advanced concepts, such as composition, aggregation and association. It also includes the problem of GOF design pattern.
103) what is the interface? Why use interfaces instead of concrete classes?
104) in Java, what are the differences between abstract classes and interfaces?
105) besides singleton pattern, what other design patterns have you used in your production environment?
106) can you explain the Richter substitution principle?
107) under what circumstances would the Dimiter rule be violated? Why is there such a problem?
108) what is the adapter mode? When to use it?
109) what are “dependency injection” and “inversion of control”? Why is it used?
110) what are abstract classes? What’s the difference between it and interface? Why do you use abstract classes?
111) constructor injection and setter dependency injection, which way is better?
112) what is the difference between dependency injection and engineering mode?
113) what is the difference between adapter mode and decorator mode?
114) what’s the difference between adapter mode and proxy mode?
115) what is a template method pattern?
116) when to use visitor mode?
117) when to use combination mode?
118) what is the difference between inheritance and composition?
119) describe overloading and rewriting in Java?
120) in Java, what is the difference between nested public static classes and top-level classes?
121) what is the difference between composition, aggregation and association in OOP?
122) give me an example of a design pattern that conforms to the open close principle?
123) the difference between abstract factory pattern and prototype pattern?
124) when to use Heyuan mode?
I am an old programmer who has been engaged in this field for 10 years. I quit my job and am now a lecturer. I have compiled a set of mind maps and recorded some related videos to summarize some technologies that an architect must possess. I share them with you for your reference.
Need detailed answers can be QQ group 810589193 access!
1. High performance architecture
1.1. Distributed architecture thinking
1.2. Zookeeper distributed environment
1.3. Nginx high concurrent streaming advanced combat
1.4. ActiveMQ message middleware
1.5. Rabbitmq message middleware
1.6. Kafka million
1.7. Memcached advanced combat
1.8. Redis high performance cache database
1.9. Mongodb advanced combat
1.10. High performance cache development
1.11. MySQL high performance storage
1.12. Fastdfs distributed file storage
1.13. Distributed solutions for high concurrency scenarios
2. Microservice architecture
2.1. Past and present of service
2.2. RPC solution based on Distributed Idea
2.3. Dubbo application and source code interpretation
2.5. Spring cloud application and source code interpretation
2.6. Docker virtualization technology
3. Open source framework
3.1. Spring 5 overview
3.2. Spring5 framework architecture
3.3. Spring5 environment construction
3.4. IOC source code analysis
3.5. AOP source code analysis
3.6. Spring MVC
4. Architect Foundation
4.1. JVM performance tuning
4.2. Java program performance optimization
4.4. Advanced concurrent programming
4.6. High performance netty framework
4.7. Linux basic and advanced
5. Team development
6. B2C mall project
6.1. System design
6.2. User management subsystem
6.3. Commodity management subsystem
6.4. Search subsystem
6.5. Order subsystem
6.6. Payment system
6.7. Distributed dispatching system
6.8. Background system
The last point I want to emphasize in the interview of big companies is that the mentality is really important, which is the key to decide how to play in the interview process. If you can’t play normally, you may miss the offer because of a small mistake, so you must pay attention to it. Another point to remind, full review, is the key to eliminate your nervous state of mind, but you review enough, natural interview process will have much more confidence. The above interview questions and answers I have organized into a PDF document
This document can be concerned with my official account: future direct access.