Java Reference
In-Depth Information
Exercise R9.11. How would you reorganize the
DataSetTester3
program if you needed to make
RectangleMeasurer
into a top-level
class (that is, not an inner class)?
Exercise R9.12. What is a callback? Can you think of another use for a
callback for the
DataSet
class? (Hint: Exercise P9.8.)
Exercise R9.13. Consider this top-level and inner class. Which variables
can the
f
method access?
public class T
{
public void m(final int x, int y)
{
int a;
final int b;
class C implements I
{
public void f()
{
. . .
}
}
final int c;
. . .
}
private int t;
}
431
432
Exercise R9.14. What happens when an inner class tries to access a
non-
final
local variable? Try it out and explain your findings.
GExercise R9.15. How would you reorganize the
InvestmentViewer1
program if you needed to make
AddInterestListener
into a top-level class (that is, not an inner
class)?
GExercise R9.16. What is an event object? An event source? An event
listener?