<< Chapter < Page Chapter >> Page >

When this method is called, it does the following:

  • Displays the value of the constructor parameter passed to the object when it was constructed.
  • Displays the identification of the object based on the value of the object counter when it was constructed.

Containment hierarchy is displayed

Because cShow calls bShow , which in turn calls aShow , we should expect that the call to the cShow method on an object of the member class named C would display information about the containment hierarchy.

(Simply as another reminder, the containment hierarchy is completely independent of the inheritance hierarchy.)

Calling cShow

Referring once more to Listing 1 , we see that the method named cShow is called on the object of the class named C when that object is instantiated. We will see the result of that call shortly.

The cShow method

Listing 14 shows the beginning of the cShow method.

The code in Listing 14

  • Displays a string separator to help locate the specific output in the large quantity of output produced by the program.
  • Displays the object identifier based on the object counter.
  • Displays the value passed to the constructor when the object was instantiated.

The screen output

The code in Listing 14 produces the output shown in Figure 7 .

As you can see by comparing this with Listing 1 , this is the first object instantiated from the class named C, and is the object instantiated from thestatement in the main method in Listing 1 . (The constructor parameter value is 3.)

Call the bShow method

Continuing with the code in the cShow method, the code in Listing 15 calls the private method named bShow on the containing object of the class B to which this object is linked.

As you will recall from the previous discussion, the code in the bShow method will, in turn, call the aShow method on the containing object of the class named A to which the object of the class B is linked.

The screen output

The code in Listing 15 produces the output shown in Figure 8 .

As you can see in Figure 8 , the linked objects of the classes B and A are the first objects instantiated from those classes. In addition, the savedvalues of the constructor parameters show that these are the objects that were instantiated by the statement in the main method of Listing 1 .

Call the aShow method

As I explained earlier, the object of the class C is linked to the containing object of the class named B. The code in Listing 16 shows that the object of the class C is also linked to the containing object of the class A (even though the containing class named A is one level removed in the containment hierarchy).

Implicit access

The methods of a member class have implicit access to all members (including private members) of all containing classes. Thus, the code in the cShow method, belonging to the object of the class named C, can directly call the private aShow method of the containing class named A.

The screen output

Therefore, the code in Listing 16 produces the output shown in Figure 9 .

You can tell by the values displayed in Figure 9 that the aShow method called in Listing 16 was called on the same object on which the aShow method was called by the code in Listing 15 . However, in Listing 15 , the bShow method was called first, which in turn called the aShow method.

Questions & Answers

how environment affect demand and supply of commodity ?
Amos Reply
Wht at the criteria for market ?
Amos
what is difference between monitory policy and fiscal policy?
Malik Reply
monetary policy is a policy thrust by National Govt(CBN) to influence government spending, purchase &taxes
Frank
necessity of economics
Pamela Reply
I will say want,choice,opportunity cost,scarcity,scale of preference
Alao
what is monopoly market.How price output are determined under monopoly market
bisham
b) Monopoly market is an impecfect market where s single firm having the innovation to produce a particular commodity.Prices are determined through output since there are no other competitive.
Frank
Monopoly market:firm has market power & does not respond to market price
Frank
Explain the process of price determination under perfect competition market with suitable diagram
bisham Reply
Price determination under perfect competition via this process :firms have no market power to influence price rather firms respond to market price.
Frank
price is different from demand- demand is amount of commodity
Effah Reply
demand is amount /quantity of commodity a potential buyer is willing to buy at a given price at market
Frank
demand is a desire of customer on commodity with the ability to pay it and willing to buy it at given price of commodity
Harika
demand is price of what
Faith Reply
show that shortrun average cost
Baby Reply
what is economics
Mbah Reply
what is money
Mbah
what is money
Mbah
Difine macro economics
agaba
money is a medium of exchange between goods and services,maybe inform of currency.
Wesonga
Economics is study of how human beings strive to satisfy numerous wants using limited available resources.
Wesonga
how do you find the maximum number of workers the firms should employ order to produce where there are increasing returns
Jane
what are implications of computing national income?.
agaba
pl
MUDASIRU
what is the formulae for calculating national income
MUDASIRU
it calculated by value added method
Praveen
classify the production units like agriculture, banking, transport etc
Praveen
money is anything that is generally acceptetable for human
Ogbaji
Estimate the net value added(NVA) at fixed cost by each industrial structure
Praveen
definition of unemployment
Adam Reply
what are the causes of unemployment?
Mbubi Reply
The main causes of unemployment are listed below. 1. Frictional unemployment 2. Cyclical unemployment 3. Structural unemployment
assani
We can also categorize the causes on a broader sense as: 1. Political and 2. Social cause As unemployeement root causes are embaded in this two.
Yonathan
would opportunity cost exist if there was no scarcity?
assani
yes just because the opportunity cost arose when there is Alternative to choose among the alternatives.
BADAMASIU
I am thinking that, if our resources were unlimited, then there wouldn't be any need to forgo some wants. Hence the inexistence if opportunity cost
assani
Politics
Job
politics has done what?
assani
consider time assani
Mary
I'm Emmanuel,...I taught the main cause is the change in gov't.
Emmanuel
...Lack of capital to set up a firm respectively
Emmanuel
🙈
Emmanuel
I would like to bring in Educational levels can also be the cause the cause of the problem respectively
Emmanuel
I think the main causes of unemployment is lack of INFRASTRUCTURAL DEVELOPMENT OVER POPULATION OVER DEPENDENT ON GOVERNMENT LACK OF SELF EMPOWERMENT...
ananti
lack of skills among the new generation is the serious issue.
Vishal
Where I come from , I don't see why education or personal aspects seem to do with unimployment, technically the motivation and eigerness in all works of live is there , dispite the cultural influence and physical bearriors;the thing we lacking is Government Support and open market ethics.
Joe
sorry about that-(repation). We have a over powering ethical political system that's displacing the marketing asspects of economy and causing large scale unemployment right across the board...
Joe
can someone Explain Expansionary Monetary Policy and Contractionary Monetary Policy Using one of the instrument of Monetary Policy? Please am kinda lost here?. ta
Emmanuel Reply
using a graph show the case of substitute and compliment goods
Ade Reply
can anyone give me a simple explanation to Five Sector Macroeconomics?
Emmanuel
Can someone please define what economics is
jason Reply
economics simply is a social science subject that study human behavior.
dajan
economics is a social science which studies human behaviour as a relationship between ends and scarce means that has alternative uses
Alao
Can someone please tell me how to calculate GDP
Emmanuel
emmanual kapal to calculate GDP (Gross Domestic Product) has three method in calculating it (1)income approach (2) expenditure approach (3) value added method
Alao
thanks Alae
Emmanuel
u are welcome
Alao
in basic terms economics is revered to as battery system, it date back to when Men sees the need to exchange sapless goods and produce to gain , either wealth , basic necessities or to establish trading ties for personal benefit or social asspects in terms of coexistence and continuity, future .
Joe
what is the law of demand
Berlinda Reply
keep other thing constant, when the price increases demand decrease when the price decreases demand increases of the commodity.
sj
all things being equal,quantity demanded decrease as price increase and increase as price decrease
Seth
there's practial joke to it ..." the higher the demand ; scarcity, increase in production and drop in quality"... quite the controversy - for example China vs Europe, United States and we are all boxed up in between somewhere...
Joe
Other thing remain constant the low price of commodity the high quantity of commodity and vice versa is true
Baraka
Explain Effective demand
Anita Reply
What is effective demand
Anita
like Modi is in demand...best example of effective demand
Pranav
Don't get you
Anita
Anita you mean you don't get me or who?
Onyeking
level of demand that represents a real intention to purchase by people with the means to pay
Pranav
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





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