原创 泛型Generics

Type safety means that the compiler will validate types while compiling, and throw an error if you try to assign th

原创 Starvation and Fairness

If a thread is not granted CPU time because other threads grab it all, it is called “starvation”. The thread is “st

原创 Thread safety and Shared Resource

一、Local Variables Local variables are stored in each thread’s own stack. That means that local variables are never

原创 Reader、Writer、BufferedWriter源碼解析

Text streams – Interacts as Unicode characters which are 16 bits 一、Characters in Unicode Today, many applications u

原创 HashMap、Hashtable、LinkedHashMap、TreeMap 數據結構及不同點

一、HashMap hashing:transformation of a string of characters(Text) to a shorted fixed-length value that represents or

原创 Blocking Queues

A blocking queue is a queue that blocks when you try to dequeue from it and the queue is empty, or if you try to en

原创 Garbage Collection按代回收執行過程

一、 What is Automatic Garbage Collection? Automatic garbage collection is the process of looking at heap memory, ide

原创 解決Race Conditions的方法之一:synchronized

synchronized解決了什麼問題? Race Conditions Race conditions occur only if multiple threads are accessing the same resource

原创 Thread Pools

Thread Pools are useful when you need to limit the number of threads running in your application at the same time.

原创 InputStream、OutputStream、BufferedOutputStream源碼解析

The InputStream/OutputStream works with Bytes which are 8 bits. read、write根上調用的是native方法 一、read 1.方法 /* Reads a byt

原创 java序列化、反序列化、serialVersionUID

一、Serialization、Deserialization Serialization is a mechanism of converting the state of an object into a byte strea

原创 Exception處理機制、Exception Handler三種方法

Throwable、Exception、Error The Throwable class is the superclass of all errors and exceptions in the Java language.

原创 Memory Consistency Errors解決方案:Happens-before relationship

一、JMM在多線程環境下的存在的問題之一:Memory Consistency Errors Memory Consistency Errors:Memory consistency errors occur when dif

原创 Thread Signaling

The purpose of thread signaling is to enable threads to send signals to each other. Additionally, thread signaling

原创 引用傳遞、值傳遞、Shallow Copy & Deep Copy

Java值傳遞、引用傳遞 Java is always pass-by-value.若是基本數據類型,值爲數據值;若是引用數據類型,其存儲的是地址值。 【棧幀中局部變量表,存放基本數據類型變量和值;引用數據類型存放變量和對象地址值