Home >Java >javaTutorial >Java interview questions and answers (4)

Java interview questions and answers (4)

PHP中文网
PHP中文网Original
2017-07-12 18:12:571537browse

1. Under what circumstances does the JVM perform GC? What are the GC strategies?

When the application allocates new objects, the budget size of the GC generation has reached the threshold, such as the 0th generation of GC is full; the code actively and explicitly calls System.GC.Collect(); other special circumstances, such as the system Reporting insufficient memory, CLR unloading AppDomain, CLR shutdown, and even changes in system parameter settings in some extreme cases may also cause GC recycling

2, What is OutOfMemoryError and StackOverflow

If the virtual machine cannot apply for enough memory space when expanding the stack, an OutOfMemoryError exception will be thrown. This is generally caused by the amount of data applied for such as arrays, ArrayList, HashMap, etc. being too large.

If the stack depth requested by the thread is greater than the maximum depth allowed by the virtual machine, a StackOverflowError exception will be thrown. This is generally due to insufficient stack memory due to a large number of recursive operations.

Generally, an OutOfMemoryError exception cannot be generated in a single-threaded program. OutOfMemoryError will also occur when using multi-threading, because the stack is private to the thread, and the method area will overflow if there are many threads.

3. JVMWhat problems will occur if stack space is allocated too much?

4. How to detect infinite loops and deadlocks in JVM

##Deadlock:

Infinite loop:

5. Explain##BIO, NIO, NIO2, AIO

6.Poll and SelectDifference?

7HTTP/1.1 Basics

8. Three-way handshake and four-way wave in TCP protocol

#

The above is the detailed content of Java interview questions and answers (4). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn