Problem
A. What does the Java 'new' operator do?
B. When does a class require an 'equals' method to be written?
C. What is method "overriding"? Why would you override a method?
D. What advantages does inheritance provide in Java?
E. What is dynamic binding? What advantage does it provide?
F. How is it possible for two String objects with identical values not to be equal when compared with the == operator?
G. Why can a class variable of a base type be set to reference an object of a derived type, eg:
Shape s = new Circle("Blue", 1.0);
H. How can the methods of a derived class access private instance variables of its base class?
I. The following try/catch has code to explicitly handle any IllegalArgumentException thrown. Show the modified code that will also catch any other type of exception that could be thrown by code called within the try block.
try
{
... methods called here ...
...
}
catch (IllegalArgumentException e)
{
... code to handle IllegalArgumentException ...
}
J. How is the caller's flow of control (sequence of statement execution) different when an exception is thrown from a method that it calls from within a try block, vs. when the method returns normally?