Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Exceptions  RSS feed

Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I selected 1 as answer but the answer given is 3. Please explain.
- Thanks

public class Question72
public Question72() throws IOException
throw new IOException();
Assume that the defination of Question72E begins with the line
public class Question72E extends Question72
It is required that none of the constructors of Question72E should throw any checked exception.

1.It can be achived by placing the call to the superclass with a super keyword , which is placed in a try block with a catch block to handle the
IOException thrown by the super class.
2.It can be achived by avoiding explicit calls to the base class constructor.
3.It cannot be done in the Java Laungage with the above definition of the base class.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!