[Bluej-discuss] Ex 9.7

Davin McCall davmac at bluej.org
Sun Nov 12 07:19:59 GMT 2006


Hi John,

I don't happen to have a copy of the book handy at the moment, but:

What determines "what prints where" is simply a matter of the order in which things print - and that is the same order as the relevant print statements in your code are executed. This order is of course determined solely by the structure of your program. Understanding how the structure and the execution order are related is critical to understanding how to program.

I suggest you need to look at your program and - in your head - follow the execution path to see when each statement will be executed. Then you should be able to see why some things are printed before others, and hopefully also where you need to put your own print statements to get the desired behaviour.

If this is too difficult (the execution path may be very complex) you can use the debugger to step through your program's execution line by line. You just need to set a breakpoint at the beginning of the method you are going to call interactively, then call the method. Use the "Step" or "Step into" buttons in the debugger window to see how your program runs ("Step" will step over method calls, so I recommend using "Step into" unless the call is trivial and you already understand what it does).

There should be more information on how to use the debugger in the tutorial, or at least in the reference manual, which you can download from the web site.

I hope this is helpful & I apologise if I have oversimplified due to misunderstanding your question,

Davin



On Sat, 11 Nov 2006 20:04:19 -0500 (EST)
John Simonds <simonj2 at sage.edu> wrote:

> I am having a problem with Ex 9.7 and the problem is, I don't know how to get it to print in a specific order.
> I did the super.print(); method.  I discovered that, depending on where that is placed in one of the other classes, things print out differently, put I don't know how to get contol over what prints where.  
> 
> 
> John Simonds
> Systems Technologist
> simonj2 at sage.edu
> (518)244-3111
> (518)292-1734
> 
>  
>  
> 
> 
> 


More information about the bluej-discuss mailing list