Switch Expressions in Java 12

Java is a wonderful language, but it’s syntax tends to be a bit too verbose sometimes. It is good to see that in Java 12, the new Switch Expressions will now use pattern matching to provide simpler coding standards. Below is a simple example to illustrate the differences: In...

Rectangles – Intersection Study

Have you ever walk into a job interview, and were asked to design a program to find if 2 rectangles intersect with each other or not? This apparently is a common “technical” question in a job interview. I do agree that it is an interesting question to evaluate your...

Bubble Sort

Sorting algorithm is probably one of the first thing we learn when we study computer science.  My goal is to try to provide the simplest tutorial for you that hopefully will inspire you to think in simple way, and learn the underlying data structure and algorithm. What is bubble...

Java Modifiers

With the variety of programming languages out there, and each one of them may have a slightly different implementation on their syntax and behavior. It is kind of hard to remember them all, so it will be very helpful to have some quick cheat sheet that will provide guideline...

Tower of Hanoi – a study of recursive function

The Tower of Hanoi is a classic project assignment that most student of Computer Science would encounter in their academic classes. It is usually used to illustrate the power of recursive logic in a program, of cause that it is also a great puzzle to give some good exercise to...