<< Chapter < Page Chapter >> Page >

Complete program listing

A complete listing of the program discussed in this module is show in Listing 25 .

Miscellaneous

This section contains a variety of miscellaneous information.

Housekeeping material
  • Module name: Java OOP: Member Classes
  • File: Java1636.htm
  • Published: 11/18/13
Disclaimers:

Financial : Although the Connexions site makes it possible for you to download a PDF file for thismodule at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, you should beaware that some of the HTML elements in this module may not translate well into PDF.

I also want you to know that, I receive no financial compensation from the Connexions website even if you purchase the PDF version of the module.

In the past, unknown individuals have copied my modules from cnx.org, converted them to Kindle books, and placed them for sale on Amazon.com showing me as the author. Ineither receive compensation for those sales nor do I know who does receive compensation. If you purchase such a book, please beaware that it is a copy of a module that is freely available on cnx.org and that it was made and published withoutmy prior knowledge.

Affiliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX.

Figures

Figure 1 - Class files produced when the program is compiled.
A$B$C$D.class A$B$C.classA$B.class A.classInnerClasses06.class X.class
Figure 2 - Screen output.
In xstr for A, objCntA = 1
Figure 3 - Screen output.
In xstr for A, objCntA = 1 In xstr for B, objCntB = 1
Figure 4 - Screen output.
In xstr for A, objCntA = 1 In xstr for B, objCntB = 1In xstr for C, objCntC = 1
Figure 5 - Screen output.
Construct obj of private class D. Private class file name: A$B$C$D
Figure 6 - Screen output.
In xstr for A, objCntA = 2 In xstr for B, objCntB = 2
Figure 7 - Screen output.
-1- In cShow, objNumber = 1In cShow, cVar = 3
Figure 8 - Screen output.
-2- In bShow, bVar = 2In bShow, objNumber = 1 In aShow, aVar = 1In aShow, objNumber = 1
Figure 9 - Screen output.
-3- In aShow, aVar = 1In aShow, objNumber = 1
Figure 10 - Screen output.
-4- A$B$CA$B$C A$B$CA$B$C A$B$C
Figure 11 - Screen output.
-5- A$BA$B
Figure 12 - Screen output.
-6- A
Figure 13 - Screen output.
-7- In cShow, bVar = 20A$B In cShow, aVar = 10A
Figure 14 - Screen output.
-8- In bShow, bVar = 20In bShow, objNumber = 2 In aShow, aVar = 1In aShow, objNumber = 1
Figure 15 - Screen output.
-9- In aShow, aVar = 10In aShow, objNumber = 2
Figure 16 - Screen output.
-10- className = CtoString in Class C className = XtoString in Class X

Listings

Listing 1 - The main method.
public class InnerClasses06{ public static void main(String[]args){ new A(1).new B(2).new C(3).cShow();}//end main }//end class InnerClasses06
Listing 2 - The class named X.
class X{//extends Object by default protected String className = "X";public String toString(){ return "toString in Class X";}//end overridden toString }//end class X
Listing 3 - Beginning of the top-level class named A.
class A{ private int aVar;private int objNumber = 0; private static int objCntA = 0;private static int objCntB = 0; private static int objCntC = 0;

Questions & Answers

how did the oxygen help a human being
Achol Reply
how did the nutrition help the plants
Achol Reply
Biology is a branch of Natural science which deals/About living Organism.
Ahmedin Reply
what is phylogeny
Odigie Reply
evolutionary history and relationship of an organism or group of organisms
AI-Robot
ok
Deng
what is biology
Hajah Reply
cell is the smallest unit of the humanity biologically
Abraham
what is biology
Victoria Reply
what is biology
Abraham
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with java. OpenStax CNX. Jun 29, 2016 Download for free at https://legacy.cnx.org/content/col11441/1.201
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?

Ask