If my class already extends from some other class what should I do if I want an instance of my class to be thrown as an exception object ?


One can not do anytihng in this scenarion. Because Java does not allow multiple inheritance and does not provide any exception interface as well.



Explore posts in the same categories: Java Interview Questions


BOOKMARK THIS : del.icio.us | Digg it | Furl | reddit |


Related Questions :

  • If I want an object of my class to be thrown as an exception object, what should I do ?
  • The class should extend from Exception class. Or you can extend your class from some more precise exception type also....
  • What are Checked and UnChecked Exception?
  • A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Making an exception checked...
  • What are Checked and UnChecked Exception?
  • A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Making an exception checked...
  • Explain the ISA and HASA class relationships. How would you implement each in a class design?
  • A specialized class "is" a specialization of another class and, therefore, has the ISA relationship with the other class. An...
  • What is static in java?
  • Static means one per class, not one for each object no matter how many instance of a class might exist....
  • Difference Declaration and Instantiation an object?
  • Dim obj as OBJ.CLASS with either Set obj = New OBJ.CLASS or Set obj = CreateObject(?OBJ.CLASS?) or Set obj = GetObject( ,? OBJ.CLASS?) or Dim...
  • What is final, finalize() and finally?
  • final : final keyword can be used for class, method and variables. A final class cannot be subclassed and it...
  • What are some alternatives to inheritance?
  • Delegation is an alternative to inheritance. Delegation means that you include an instance of another class as an instance variable,...
  • What is Structured Exception Handling?
  • Structured Exception handling is a fundamental part of the CLR, and provides .NET programmers with a great way of managing...
  • What does it mean that a method or field is “static”?
  • Static variables and methods are instantiated only once per class. In other words they are class variables, not instance variables....

    Comments are closed.