Preview:
import java.util.*;
class NegativeAmountException extends RuntimeException
{
String msg;
NegativeAmountException(String msg)
{
super(msg);
}
}
public class lab28
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the amount:");
int amt=sc.nextInt();
if(amt<0)
{
throw new NegativeAmountException("INVALID AMOUNT......");
}
else 
{
System.out.println("amount deposited.....");
}
}
}


downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter