File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A question on a concrete class implementing interface

 
Yin Stadfield
Ranch Hand
Posts: 58
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is written under the two-minute drill of the first chapter on SCJP 6 Sun Certified Java Programmer Study Guide by Kathy Sierra and Bert Bates:

A legal nonabstract implementing class has the following properties:
It provides concrete implementations for the interface's methods. (1)
It must follow all legal override rules for the methods it implements. (2)
It must not declare any new checked exceptions for an implementation method. (3)
It must not declare any checked exceptions that are broader than the exceptions declared in the interface method. (4)
It may declare runtime exceptions on any interface method implementation regardless of the interface declaration. (5)
It must maintain the exact signature (allowing for covariant returns) and return type of the methods it implements (but does not have to declare the exceptions of the interface). (6)

I've finished reading the Chapter 1, and after reading this two-minute drill, I'm positive that those that (3-6) are not discussed on Chapter 1 (I'm positive there's a chapter dedicated to this but not this chapter). Anyway, I just want to understand those things now so I thought I ask here. I would appreciate it if anyone can expound on item (2-6) (with/without examples would do). Thanks!
 
Enkita mody
Ranch Hand
Posts: 333
Firefox Browser Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Leave them for Exception handling chapter Okay ?? GOOD BYE
 
Yin Stadfield
Ranch Hand
Posts: 58
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Atleast expound on number (5). It may declare runtime exceptions on any interface method implementation regardless of the interface declaration. (5)
 
Ankit Gareta
Ranch Hand
Posts: 67
Java
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yin, As you first read the exception chapter , at that time you will understand that things....

Yin Stadfield wrote:Atleast expound on number (5). It may declare runtime exceptions on any interface method implementation regardless of the interface declaration. (5)


That's says : You can declare any runtime exception , regardless you don't declare in your interface method.


 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic