Abstract Classes

Question - If an abstract class is never instantiated what does it need a constructor for?

Answer - When a subclass is instantiated its super class constructor is called to construct the object.

Try these files to see:

AbstractClass.java

AbstractChild.java

Sample print out:

Created abstract class
Finished

Exception Handling

Exception handling can be confusing if you do not understand the flow of control. Here is a program that demonstrates the flow of control. ExceptionTest.java

Sample output:

Entering main()
Calling m1()
Entering m1()
Calling m2()
Entering m2()
In finally for m2()
Exiting m2()
Returning from call to m2()
Calling m3()
Entering m3()
In finally for m3()
Caught IOException in m1() ... rethrowing
In finally for m1()
Caught IOException in main()
Exiting main()

Return to Java Help Page