Baidu's first 200 pages of "Java Interview Questions" selected first article
Basic concepts
The difference between heap and stack in the operating system. What is an annotation-based section implementation. What is an object/relational mapping integration module. What is Java's reflection mechanism? What is ACID
The connection and difference between BS and CS
The difference between a cookie and a session
What is the difference between fail-fast and fail-safe mechanisms
The difference between get and post requests
The difference between Interface and abstract class
What are the advantages of IOC
The difference between IO and NIO, the advantages of NIO
What new features does Java 8 / Java 7 provide us with what are race conditions? Give an example.
What are the differences between JRE, JDK, JVM and JIT
What technologies are there for each part of MVC to implement? How to implement it?
What is the difference between RPC communication and RMI?
Introduction to JSWDL development package. Explanation of JAXP and JAXM. SOAP, UDDI, WSDL explanation.
What are the main functions of WEB containers? Please list some common WEB container names.
Can multiple classes (not inner classes) be included in a ".java" source file? What are the limitations? Let me briefly talk about the class loaders you know. Whether to implement a class loader, explain what AOP is (sectional programming)
Please briefly describe the life cycle of servlet and its related methods. Please briefly describe the principles and implementation steps of Ajax. Briefly describe the main functions of Struts. What is N-layer architecture and what is CORBA? What is the purpose of Java virtual machine? Why Java is called a "platform-independent programming language"
What is a regular expression? What is the purpose? Which package uses regular expressions to achieve pattern matching What is lazy loading?
What is tail recursion, why do you need tail recursion? What is Inversion of Control and Dependency Injection
Keywords
finalize
1. What is the finalize() method
When is the finalize() method called what is the purpose of the destructor (finalization)
The difference between final and finalize
Final
2. What are the usages of final keywords
Where can final and static keywords be used? What are their functions
The difference between final, finally, finalize
What's the difference between final, finalize and finally?
3. Can you assign values to static final type at runtime
When modifying a variable with the final keyword, is it a reference that cannot be changed, or is the referenced object that cannot be changed to a class that is declared as a final type, what does it mean?
What does throws, throw, try, catch, finally mean?
How many modifiers does Java have? What to modify
volatile
What practices have been made with volatile modifiers
What is the volatile variable? What is the difference between volatile variables and atomic variables
What guarantees does volatile type variable provide? Can a non-atomic operation be turned into an atomic operation be created?
What are the characteristics of transient variables
When to use super
How will public static void be explained as static public void explain the role of each keyword in the statement public static void main(String args[]) please tell us the scope public, private, protected, and the difference when not writing
Is sizeof a Java keyword?
static
The difference between static class and non static class
What does the static keyword mean? What are the characteristics of static typing of a private or static method in Java?
Why must the main() method be static? Can you declare that the main() method is non-static? When can you issue a call to a non-static method from within a static method? When will the static variable be loaded? Compile or runtime? When static code blocks are loaded, can member methods access static variables? Why can't static methods access member variables
switch
What type of data can an expression in a switch statement be?
Whether the switch can act on byte, whether it can act on long, or whether it can act on String
What is the difference between while loop and do loop
Operator
What is the difference between the & operator and the && operator?
What is the difference between a = a + b and a += b?
The difference between logical operators (&,|,^) and conditional operators (&&,||)
3*0.1 == 0.3 What will be returned? true or false?
float f=3.4; is correct?
short s1 = 1; s1 = s1 + 1;What's wrong?
Data structure
Basic types (Primitives)
What is the difference between basic types (Primitives) and package types (Wrappers) briefly describes the sizes of nine basic data types, as well as their package classes
Which one, int or Integer, will take up more memory? What is the difference between int and Integer? When will the parseInt() function be used
What is the default value of float and double? How to round the decimal to reserve the two decimal places after the decimal point
Can a Chinese character be stored in a char type variable, and why
Type conversion
How to convert bytes to long type How to convert byte to String
How to convert numeric characters to numbers Can we cast int to a variable of type byte? If the value is greater than the range of type byte, what will happen? Can you assign a double value to a variable of type long without casting?
Array
How to trade off whether an unordered array is used or an ordered array, how to determine whether an array is null or empty? How to print an array? How to print duplicate elements in an array
What is the difference between Array and ArrayList? When should Array be used instead of ArrayList
Array and linked list data structure description, is there any length() method for each time complexity array? Is there any length() method for String
queue
What are queues and stacks, list their differences
What is BlockingQueue Brief description of the uses and differences of ConcurrentLinkedQueue LinkedBlockingQueue.
Storage performance and features of ArrayList, Vector, LinkedList
String
StringBuffer
What is the difference between ByteBuffer and StringBuffer
HashMap
What is the working principle of HashMap? What is the internal data structure?
How to determine the capacity of HashMap table? What is loadFactor? How does this capacity change? What problems will this change bring?
What is the data structure implemented by HashMap? How to implement it
The difference between HashMap and HashTable and ConcurrentHashMap
HashMap traversal method and efficiency
How to decide whether to choose HashMap or TreeMap?
What to do if the size of HashMap exceeds the capacity defined by the load factor
Is HashMap thread-safe? What are the maps used in concurrency, and what are their internal principles, such as storage method, hashcode, capacity expansion, default capacity, etc.
HashSet
What is the difference between HashSet and TreeSet
How does HashSet work inside
How does WeakHashMap work?
Set
Elements in Set cannot be repeated, so what method can be used to distinguish between repetition or not? Should I use == or equals()? What is the difference between them?
TreeMap: What tree does TreeMap use to implement? The difference between TreeMap, HashMap, and LindedHashMap. How do TreeMap and TreeSet compare elements when sorting? How to compare elements with sort() method in the Collections tool class?
TreeSet: How to complete inverted sorting of a built TreeSet.
What is EnumSet
Hash algorithm
The role of Hashcode briefly describes the consistency. Is it possible for the Hash algorithm to have the same hashcode? What should I do when the hashcode of two objects is the same? How to get value objects Why do you need to override the hashCode method when overriding the equals method? What are the similarities and hashCode?
What is the use of a.hashCode()? What does it have to do with a.equals(b)
Where does the importance of hashCode() and equals() methods reflect
Object: What are the common methods of Object? Object class hashcode, equals design principles? Why is sun designed like this? Overview of Object class How to automatically complete all hashcode and equals implementations for child classes in parent class? What are the advantages and disadvantages of doing this?
Can random numbers be used in hashcode()?
LinkedHashMap
What is the difference between LinkedHashMap and PriorityQueue
List
What are the characteristics of the three interfaces List, Set, and Map?
Whether List, Set, Map inherits from Collection interfaces What are the different ways to traverse a List?
LinkedList
Is LinkedList a one-way linked list or a two-way linked list
What is the difference between LinkedList and ArrayList? Describe the concepts of collections, interfaces, and implementations in Java. What is the difference between LinkedList and ArrayList?
When inserting data, who is the faster ArrayList, LinkedList, Vector?
ArrayList
The default size of ArrayList and HashMap is the majority
What is the difference between ArrayList and LinkedList? When to use ArrayList?
What is the difference between ArrayList and Set?
The difference between ArrayList, LinkedList, Vector
How is ArrayList implemented, the difference between ArrayList and LinkedList
How to achieve capacity expansion of ArrayList
What is the difference between Array and ArrayList? When is Array more suitable
Talk about the storage performance and features of ArraList, Vector, LinkedList
Map
Map, Set, List, Queue, Stack
What are the different collection views does the Map interface provide? Why does the Map interface not inherit the Collection interface?
Collections
Introduction to Collection FrameWork in Java. What are the basic interfaces of the collection class framework
What is the Collections class? What is the difference between Collection and Collections? What are the best practices for implementing collection class frameworks in Collection and Map? Why does Collection not inherit from the Cloneable and Serializable interfaces say a few best practices for using Collections in Java?
The difference between legacy classes (HashTable, Vector) and existing classes in Collections
What is B+ tree, B- tree, lists the actual usage scenarios.
interface
What does Comparator and Comparable interface do? List their differences
Object
Copy (clone)
How to implement the difference between deep copy and shallow copy of object cloning. How to implement the activation mechanism. When writing the clone() method, there is usually a line of code. What is it?
Compare
When comparing objects, what is the difference between the "==" operator and the equals operation. If you want to rewrite the equals method of an object, you should also consider whether the two objects have the same value (x.equals(y) == true), but there can be different hash codes. Is this correct
Constructor
What is the constructor chain? The order of the constructor is called when creating an object?
Immutable Objects
What is immutable object
Why is String in Java immutable (Immutable)
How to build an immutable class structure? Where can I create an immutable object containing a mutable object?
How to sort a group of objects
method
Is the constructor override possible?
Can the method be static and synchronized at the same time?
Can abstract method be static at the same time, can it be native at the same time, and can it be synchronized at the same time
Which parameter passing type is supported by Java? An object is passed as a parameter to a method? Is it a value or a reference pass When an object is passed as a parameter to a method, this method can change the properties of the object and return the changed result. So, whether it is a value or a reference pass here can be overloaded? What will happen if the main method is declared private?
GC
concept
What is GC? Why have GC
When will it cause garbage collection
How does GC run new and old and what is the permanent zone
How many ways is there for GC? How to configure when an object will be GC? How to determine whether an object survives
System.gc() What does Runtime.gc() do? Can GC be executed? Can the garbage collector recycles memory immediately? Is there any way to actively notify the virtual machine for garbage collection?
When does the implementation principle of garbage collection algorithm occur in Minor GC, Major GC, Young GC and Full GC respectively? If the object reference is set to null, will the garbage collector immediately release the memory occupied by the object?
What are the best practices for garbage recycling
What are the GC collectors
What is the basic principle of a garbage collector?
What is the difference between a serial collector and throughput collector
The difference between Serial and Parallel GC
Characteristics and differences between CMS collector and G1 collector
Working process of CMS garbage collector
What is the complete GC process in JVM? How objects are promoted to senior-age throughput priority and response priority garbage collector selection
GC Strategy
Take a practical scenario and choose a GC strategy
Will garbage collection occur in the permanent generation of JVM?
Collecting Methods
What are the principles and features of mark clearing, mark sorting, and copying algorithms? Where to use it separately If you are allowed to optimize the collection method, what are your ideas?
JVM
parameter
Tell me about the main jvm parameters you know
-XX:+UseCompressedOops What is the function of
ClassLoader
What are the Java class loaders
How to load bytecode files by JVM
Memory management
Which areas are divided into JVM memory? What is the function of each area? How does an object survive and transfer in these parts? Explain the usage of stack, heap and method area in memory?
Which parameter in JVM is used to control threads to stack stack briefly describes memory allocation and recycling strategy briefly describes reordering, memory barrier, happen-before, main memory, working memory
Is there a memory leak problem in Java? Please give examples and brief descriptions of Java SoftReferenc, WeakReference and Virtual Reference
What is the memory mapped cache area
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.