Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Constructors of unimplemented Exceptions  RSS feed

 
Zafer Abu saeed
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package. Each must have a zero argument constructor and a second constructor that takes a String that serves as the exception's description.


Does this mean that only two constructors (zero argument, and String) are allowed?
Starting JDK 1.4 there is a very useful feature of wrapping exceptions using the Exception(Throwable cause) constructor. Can we use (implement) this constructor as well?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12148
255
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Zafer,

That instruction tells you the minimum number and type of constructors that your Exceptions must implement. You are free to implement any additional constructors you like.

Regards, Andrew
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!