Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Jahnavi20BCE0413 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner ReadInput = new Scanner(System.in);
- System.out.println("Input Registration number:");
- String reg = ReadInput.nextLine();
- try {
- if (reg.equals("20BCE0413")) {
- throw new RegNumException();
- }
- System.out.println("Valid Registration number");
- }
- catch(RegNumException e) {
- System.out.println("Invalid Registration number");
- }
- ReadInput.close();
- }
- }
- class RegNumException extends Exception{
- }
Add Comment
Please, Sign In to add comment