The Demons Command Each Other
From Huben's Wiki
(→(B) Calling Between Classes) |
|||
Line 1: | Line 1: | ||
+ | <!-- | ||
+ | This needs to be extended to explain the idea of execution flow during a call, especially the idea of returning to where you were called. Then the test can also be extended. | ||
+ | Have some code they can run, explaining how to step through a program in Dr. Java. | ||
+ | --> | ||
+ | [[Image:Gort.jpeg]] | ||
+ | |||
We have penetrated the mysteries of finding demon commands. Now we must seek to use those commands, and thus control our demons. | We have penetrated the mysteries of finding demon commands. Now we must seek to use those commands, and thus control our demons. | ||
==(A) First Call== | ==(A) First Call== | ||
Line 106: | Line 112: | ||
* How many arguments does setBounds() have? | * How many arguments does setBounds() have? | ||
* Do these 3 last method calls return any values? | * Do these 3 last method calls return any values? | ||
+ | |||
+ | ==(D) Do you get it?== | ||
+ | |||
+ | Look at studentdisk/Ch07/Craps/RollingDie.java. | ||
+ | * List the methods of class RollingDie. | ||
+ | * How many arguments does each of those methods need? | ||
+ | * Where are each of those methods called in class RollingDie (0 to many places.) | ||
+ | * What is the name of the constructor method? Is there a coincidence involved? | ||
+ | * How many different methods of class Math are called? | ||
All you need now are variables, objects, arguments and conditionals: then you shall understand most of the wiles of these demons in Java code. | All you need now are variables, objects, arguments and conditionals: then you shall understand most of the wiles of these demons in Java code. |