Answered You can hire a professional tutor to get the answer.

QUESTION

abstract class Intersection { // lists of roads to and from this intersection private final LinkedList lt;Roadgt; outgoing = new LinkedList...

In the code distributed on March 22, in classIntersection, two new "getter" methods have been added,outgoingSize()andoutgoingGet(). There is also a public 'setter' method,addOutgoing(). These three methods operate on the final private listoutgoing.

a) This means that we have public 'setter' and 'getter' methods to operate on outgoing. That suggests that outgoing might as well be public. Give examples of operations on outgoing that are forbidden to the public as a result of forcing the public to use these methods. (0.5 points)

b) But the list outgoing is already declared as final. This would seem to imply that outgoing is read-only. Give an example of an operation on outgoing that is forbidden by declaring it to be final, and give some examples of operations that change outgoing that are still permitted despite its being final. (0.5 points)

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question