Monday, 10 November 2014

The switch statement in Java

The "switch" statement works with any values that can be implicitly casted to an "int": "char", "byte", "short", "int" and also "enum". Therefore "switch" does not work with: "long", "float" and "double".

Since Java 7, it is also possible to use a String in the switch statement.

Wednesday, 5 November 2014

String in Java

In Java, the encoding of a String is in UTF-16 by default. A String object is immutable. It means that it is not possible to modify its value. Each time you assign a value to a String variable, this variable refers to a new String object.

Sunday, 2 November 2014

Serialization

Serialization is the action to save the state of an object into a specific format, like for example a string.