Initializing your objects is an important part of coding in Java, if you care at all about managing your memory. You will also find that properly initialized object creation leads to fewer problems with bugs. This article will explain what objects are in Java, why you should initialize them, and how to accomplish the task of safely creating Java objects.
Your lesson in how to initialize your very first object in a Java program has come to an end. We talked some theory, and took a look at some code, but the only way that you will know if you can do it is to go out and try it.
If you want you can give the coffee example a try, but that's really limited in usefulness for you as a programmer. Instead, I suggest you give making and initializing your own object a try.
If you do this, you will know whether you can create and not just imitate. Don't be scared, you know that you want to give it a try. So what are you waiting for? Open up your compiler and make yourself a program, and initialize some Java objects!.
I'd like to mention one important point: I did not originally create the code examples I used. I adapted them from some work that came from an item posted on Java World in 1998.