Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Type Cast in Java

  1. You cannot cast between integer and boolean values. However it is trivia to convert data between integer and boolean. For example, int i = b ? 1 : 0; convert a boolean value b into an integer value i, and boolean b = i != 0 convert an integer value i into a boolean value …

String in Different Programming Languages

A string is essentially a sequence of characters. This is how string is implemented in many programming languages (string in Java is different). For this reason, you can operate string like an array in some programming languages. This post is a shallow summary on strings in different programming languages. For …

Java Programming Style

Good Writing Style

  1. It is recommend to always use {} if even there is only one statement inside it. The reason is that you never know whether you are going to add more statements into it or not. And it will make the code more readable.

  2. Feel free to declare the …