Revised: Wed May 11 15:16:30 CDT 2016
This page is included in the following Books:
Table of contents
- Preface
- Preview
- Discussion and sample code
- Run the program
- Summary
- What's next?
- Complete program listing
- Miscellaneous
- Figures
- Listings
Preface
This module is one in a collection of modules designed for teaching ITSE2317 - Java Programming (Intermediate) at Austin Community College in Austin, TX.
(Editor's note: As you read this module, you will see that it was originally written around 2003. However, despite many improvements in Java sincethen, most of what was true then is still true in 2013.)
This module makes several references to my website, which is located at (External Link) .
Viewing tip
I recommend that you open another copy of this module in a separate browser window and use the following links to easily find and view the Figuresand Listings while you are reading about them.
Figures
- Figure 1 . Class files produced when the program is compiled.
- Figure 2 . Screen output.
- Figure 3 . Screen output.
- Figure 4 . Screen output.
- Figure 5 . Screen output.
- Figure 6 . Screen output.
- Figure 7 . Screen output.
- Figure 8 . Screen output.
- Figure 9 . Screen output.
- Figure 10 . Screen output.
- Figure 11 . Screen output.
- Figure 12 . Screen output.
- Figure 13 . Screen output.
- Figure 14 . Screen output.
- Figure 15 . Screen output.
- Figure 16 . Screen output.
Listings
- Listing 1 . The main method.
- Listing 2 . The class named X.
- Listing 3 . Beginning of the top-level class named A.
- Listing 4 . Constructor for class A.
- Listing 5 . Beginning of the member class named B.
- Listing 6 . Constructor for class B.
- Listing 7 . Beginning of the member class named C.
- Listing 8 . Beginning of constructor for class C.
- Listing 9 . The private member class named D.
- Listing 10 . More constructor code for class C.
- Listing 11 . More constructor code for class C.
- Listing 12 . The method named bShow.
- Listing 13 . The method named aShow.
- Listing 14 . Beginning of the cShow method.
- Listing 15 . More cShow method code.
- Listing 16 . Call the aShow method.
- Listing 17 . More cShow method code.
- Listing 18 . More cShow method code.
- Listing 19 . More cShow method code.
- Listing 20 . More cShow method code.
- Listing 21 . More cShow method code.
- Listing 22 . More cShow method code.
- Listing 23 . Overridden toString method in class C.
- Listing 24 . More cShow method code.
- Listing 25 . Complete program listing.
Preview
What can you include in a class definition ?
There are several different kinds of items that can be contained in a class definition. As you learned in the early modules in this series, the listincludes:
- Static variables
- Instance variables
- Static methods
- Instance methods
- Constructors