Look! The output changed! It was a Good Thing (tm) I passed by and corrected
the way your output looked; just imagine if some poor soul had written code
for you that produced that other output in your original post. All the effort would've
been wasted. Why don't you give it a try yourself first?
As you may have read (however, probably didn't), we shouldn't give you ready made answers (and it's good that way). In the guidelines, you'll even find a very similar example to yours. (But solved in C/C++.)
If you're new to Java, read this article about free classes - it will help you to understand the basics and you will be able to solve the problem.
If you get stuck or don't understand something, even after looking up some other sources (like the API from sun), feel free to ask here.
Comment