I've a question regarding the following snippet from Core Java. It explains why interfaces are needed in Java, but something other made me confused.
Now you saw what a class must do to avail itself of the s... - justpaste.it (if I paste the quote here, I get the "Page not found" error after posting -.^)
What made me confused are the underlined fragments. This is rather a question out of curiosity: the first fragment reads that the compiler must be sure that a method exits at a compile time, whereas the second fragment denies it - if a[i] doesn't have the specified compareTo method, a JVM simply throws an exception. Can someone clarify this issue?
No comments:
Post a Comment