
public class FooException extends Exception { public FooException() { super(); System.out.println("hdihfiuhif"); } public FooException(String message) { super(message); System.out.println("hdihfiuhif"); } public FooException(String message, Throwable cause) { super(message, cause); System.out.println("hdihfiuhif"); } public FooException(Throwable cause) { super(cause); System.out.println("hdihfiuhif"); }
public void calculate() throws FooException, Exception
{
try {
int i = 5;
throw new FooException("sff");
}
catch(FooException ex) {
// Print error and terminate application.
ex.printStackTrace();
System.exit(1);
} catch(Exception ex) {
// Rethrow as FooException.
throw new FooException(ex);
}
}
public static void main(String args[])
{
FooException oo=new FooException();
oo.calculate();
}
}
I'm getting error in "oo.calculate()" as "Unhandled exception type FooException - Unhandled exception type Exception" plz help me.

public class FooException extends Exception {
public FooException() {
super();
System.out.println("hdihfiuhif");
}
public FooException(String message) {
super(message);
System.out.println("hdihfiuhif");
}
public FooException(String message, Throwable cause) {
super(message, cause);
System.out.println("hdihfiuhif");
}
public FooException(Throwable cause) {
super(cause);
System.out.println("hdihfiuhif");
}
public void calculate() throws FooException, Exception
{
try {
int i = 5;
throw new FooException("sff");
}
catch(FooException ex) {
ex.printStackTrace();
System.exit(1);
} catch(Exception ex) {
throw new FooException(ex);
}
}
public static void main(String args[])throws Exception
{
FooException oo=new FooException();
oo.calculate();
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.