CHAPTER 5: Introduction to Java: Objects, Methods, Classes, and Interfaces 163
Coding Your Galaxy.java Class with Eclipse ADT
Now all you need to do is to type in your seven instance variable declarations at the top of the
class, and then a Galaxy( ) constructor method under that, and finally the four .set( ) and four .get( )
methods, which I have paired together logically, as shown in Figure 5-7. If you type everything in
accurately and all of your data types match, you will get the same error-free result that I did, which
you can see in Figure 5-7. As you’ll see during the book, Eclipse uses red x icons for errors and
yellow! icons for warnings, none of which are appearing in our Java editing pane shown here, so
our Java code is error (and warning) free. Let’s compile the app just to make sure!
Figure 5-6. Bootstrap Galaxy.java public class definition that the Eclipse New Java Class dialog created