List Headline Image
Updated by X Wang on Nov 09, 2013
X Wang X Wang
10 items   1 followers   0 votes   70 views

Java in Diagram

Illustrates Java concepts in diagrams.

The Introduction of Memory Leaks

One of the most significant advantages of Java is its memory management. You simply create objects and Java Garbage Collector takes care of allocating and freeing memory. However, the situation is not as simple as that, because memory leaks frequently occur in Java applications.

Diagram to show Java String's Immutability

Here are a set of diagrams to explain Java String's immutability. 1. Declare a string 2. Assign a string variable to another string variable 3. Concat string Summary Once a string is created in memory(heap), it can not be changed. We should note that all methods of String do not change the string itself, but rather return a new String.

The interface and class hierarchy diagram for collections with an example program

First of all, "Collection" and "Collections" are two different concepts. As you will see from the hierarchy diagram below, "Collection" is a root interface in the Collection hierarchy but "Collections" is a class which provide static methods to manipulate on some Collection types. 2. Class hierarchy of Collection The following diagram demonstrates class hierarchy of Collection.

Exception Hierarchy in Java

This tutorial is about exception hierarchy in Java. It has a hierarchical diagram to illustrate the exception class hierarchy.

Monitors - The Basic Idea of Java synchronization

If you took operating system course, you would know monitor is an important concept of synchronization in operating systems. It is also used in Java synchronization. 1. What is a Monitor? A monitor is like a building that contains a special room which can be occupied by only one customer(thread) at a time.

The substring() Method in JDK 6 and JDK 7

The substring(int beginIndex, int endIndex) method in JDK 6 and JDK 7 are different. Knowing the difference can help you better use them. For simplicity reasons, in the following substring() represent the substring(int beginIndex, int endIndex) method. 1. What substring() does? The substring(int beginIndex, int endIndex) method returns a string that starts with beginIndex and ends with endIndex-1.

JVM Run-Time Data Areas

This is my note of reading JVM specification. I draw a diagram which helps me understand. 1. Data Areas for Each Individual Thread (not shared) Data Areas for each individual thread include program counter register, JVM Stack, and Native Method Stack. They are all created when a new thread is created.

What does a Java array look like in memory?

Arrays in Java store one of two things: either primitive values (int, char, ...) or references (a.k.a pointers). When an object is creating by using "new", memory is allocated on the heap and a reference is returned. This is also true for arrays. 1.

How does Java handle aliasing?

Aliasing means there are multiple aliases to a location that can be updated, and these aliases have different types. In the following example, a and b are two variable names that have two different types A and B. B extends A. In memory, they both refer to the same location.

Java equals() and hashCode() Contract

The Java super class java.lang.Object has two very important methods defined: They have been proved to be very important especially when user-defined objects are added to Maps. However, even advanced-level developers sometimes can't figure out how they should be used properly.