Exception Handling Program
Exception Handling Program
import java.io.*;
class MinBalanceException extends Exception
{
MinBalanceException(String message)
{
super(message);
}
}
public class bank
{
public void withdraw(float w,float b) throws MinBalanceException
{
if((b-w)<1000)
{
throw new MinBalanceException("You cant withdraw this much of amount");
}
else
{
b=b-w;
System.out.println("Current balance is "+b);
}
}
public static void main(String args[])
{