lab28

PHOTO EMBED

Mon Oct 30 2023 09:52:55 GMT+0000 (Coordinated Universal Time)

Saved by @viinod07

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.....");
}
}
}


content_copyCOPY