Demonstrating three messages output in Java