Problem

It’s appropriate to use an anonymous inner class if you are going to use the class only on...

It’s appropriate to use an anonymous inner class if you are going to use the class only once. In the Factorial program in Figures 16.8a and 16.8b, we use the listener object twice, so that listener object needed to have a name. However, we used that object’s class only once, to instantiate that one object. Therefore, that object’s class did not need to have a name, and we could have used an anonymous class to create our listener object. For this exercise, modify the Factorial program to use an anonymous ActionListener class instead of the named Listener class. [Hint: The program is already set up to facilitate this change—it’s mostly cut-and-paste.]

Figure 16.8a FactorialButton program − partA

Figure 16.8b FactorialButton program − partB

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 16
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT