Write a java program for user defined exception that checks the internal and external marks. If the internal mark is greater than 40, it raises the exception “Internal marks is exceed”. If the external mark is greater than 60, it raises the exception and display the message “The external marks is exceed”. Create the above exception and use it in your program.
Answers
Answered by
19
Answer:
class NumberIsGreaterException extends Exception { NumberIsGreaterException() { System.out.println("User Exception "); } } public class TestMain { public static void main(String args[]) { try { int m = Integer.parseInt(args[0]); if (m > 100) { throw new NumberIsGreaterException(); } } catch (NumberIsGreaterException e) { System.out.println(e); ...
Similar questions
Math,
3 months ago
Math,
8 months ago
English,
8 months ago
Social Sciences,
1 year ago
Math,
1 year ago