Java knowledge necessary for testing (2) — advanced things of Java

Java advanced

Class loading process

Load (create class object) - > connect (verify - prepare - parse) - > class initialization

Class loader class

Root class loader: loads Java core classes

Extension class loader: loads the jar package in the JRE directory

System class loader: loads user-defined classes and jar packages under classpath

What is the java reflection mechanism based on

Through reflection, we can directly manipulate classes or objects, such as obtaining the class definition of an object, obtaining the properties and methods declared by the class, calling methods or constructing objects, and even modifying the class definition at run time

What principles are dynamic agents based on

It is convenient for the runtime to dynamically build the proxy and dynamically process the proxy method call mechanism

The difference between dynamic agent and static agent

Static agent: write the agent class in advance. The disadvantage is that each business class must correspond to an agent class, which is not flexible

Dynamic proxy: automatically generate proxy objects at runtime. The disadvantage is that it takes extra time to produce proxy objects and call proxy methods

What byte streams are there?

InputStream,FileInputStream,BufferedInputStream

OutputStream,FileOutputStream,bufferedoutputstream

DataInputStream,DataOutputStream

ByteArrayInputStream,ByteArrayOutputStream

ObjectInputstream,ObjectOutputStream

PrintStream,SequenceInputStream

What character streams are there?

Reader,InputStreamReader,FileReader,BufferedReader

Writer,OutputStreamWriter,FileWriter,BufferedWriter

CharArrayReader,CharArrayWriter,PrintWriter

What other IO streams are there?

StringReader,StringWriter,RandomAccessFile,Properties

Common network problems

Main algorithms of GC

The main objects of GC are the heap and method area. In the heap, the short-lived objects are classified as the Cenozoic generation and the long-lived objects are classified as the elderly generation

Conditions for triggering the main GC (garbage collector)

1. GC is called when the application is idle, that is, when no application thread is running

2. GC is called when the Java heap is low on memory. When the application thread is running and creates a new object during the running process, if the memory space is insufficient, the JVM will forcibly call the GC thread to reclaim memory for new allocation.

Causes of memory leaks

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>