Is it possible to change a String in Java

Everyone knows String object in Java is immutable. It means it is impossible to change its value after the object was created.

It was my answer to the question How can the value of string be changed? I was asked this question on a job interview.

But is it really impossible? Yes, it is… unless you use reflection. The following program demonstrates how you can change the value stored in a String object:

Read the rest of this entry »

Advertisements

InputStream.mark documentation is broken (J2SE v1.4.2)

Documentation for InputStream in J2SE v1.4.2 is broken. Description of mark(int) ends with garbage:
Documentation for InputStream.mark(int) ends with garbage

Because of this, javadoc for subsequent methods is not available at all.

Fortunately, the documentation for Java 6 shows the full description of InputStream.