Jonathan Li

Greenhorn
+ Follow
since Feb 05, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jonathan Li

well so it seems that top-most classes can't extend inner classes because there's no way to obtain an enclosing instance...but inner classes will indeed be able to extend other inner classes, static or not.
it's a tricky question.
think of it this way. the explicit (Base) cast is not needed. without it, the actual object type is Child...so the Child's method is run.
the cast only says that the reference is of type Base (which it is anyway with or without the cast)...the actual object at runtime is indeed instanceof Child...dynamic binding then kicks in, and the rest is history.
actually the question is wrong. the code does not compile at all because you're using a keyword (short) as the class name.
abstract classes can have 0 abstract methods. abstract classes merely say that we eventually will extend the class. the fact that we have fully implemented methods in an abstract class does not conflict with this notion. however, even 1 abstract method makes the entire class abstract because an unimplmented method implies that the class is unfinished...so it must be abstract.
as far as new WindowAdapter(), you're not instantiating WindowAdapter class at all...you're creating an anonymous inner class (an extension of the abstract WindowAdapter) and immediately instantiating THAT child class, which of course, is itself not abstract at all.