Is it required to provide an accessor andor mutator method


1. Is it required to provide an accessor and/or mutator method for every instance variable of a class? If yes, explain why this is required, and if no, explain why not.

2. If an overridden method in a subclass needs to call the overridden superclass method, how is this accomplished?

3. Write the Java code to declare a new class Bee which is a subclass of Insect. The noise made by a Bee is "Buzz".

4. Write the Java code to declare a new abstract class Amphibian that implements the MakesNoise interface.

5. Write the Java code to declare a new class Frog which is a subclass of Amphibian. The noise made by a Frog is "Ribbet".

6. Modify the run() method of Main and add some Bees and Frogs to critters. Build your program and verify that it works correctly. Include all of your .java source code files in the zip archive that you submit for grading.

7. Explain how a local class differs from an inner class.

8. Explain how an anonymous class differs from an inner and local class.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Is it required to provide an accessor andor mutator method
Reference No:- TGS01117432

Now Priced at $40 (50% Discount)

Recommended (90%)

Rated (4.3/5)