Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+36 votes

I am confused about question 13 and question 15:
13.A line of code with " = new Runnable() { ... }" is using (choose the BEST option)
a.a static nested method
b.a method local inner class
c.an inner class
d.an anonymous inner class
15.Which of the following is NOT a sensible use for a ChangeListener?
a.executing action whenever the user text in text field.
b.executing action whenever the user move slider
c.executing action whenever a button is clicked.

Can anyone help me with this?

asked in CSC285_Fall2018 by (1 point)

1 Answer

+17 votes
 
Best answer

On #15, I took it that a and b are actions called by changes in the Control's internal states while c is simply an action called by the event.

On #13, the line of code is a class, so not a. The reading defines a method local inner class as one that can only be instantiated within the method it was defined and an anonymous inner class as a class that is declared and instantiated simultaneously generally for the purpose of overriding the method of a class or an interface. The line of code in question instantiates the Class Runnable, and will ultimately override the run() method. So ... it's an anonymous inner class.

I think.

answered by (1 point)
selected by
...