throwing exceptions java
Java
/* In this program we are checking the Student age
* if the student age<12 and weight <40 then our program
* should return that the student is not eligible for registration.
*/
public class ThrowExample {
static void checkEligibilty(int stuage, int stuweight){
if(stuage<12 && stuweight<40) {
throw new ArithmeticException("Student is not eligible for registration");
}
else {
System.out.println("Student Entry is Valid!!");
}
}
public static void main(String args[]){
System.out.println("Welcome to the Registration process!!");
checkEligibilty(10, 39);
System.out.println("Have a nice day..");
}
}
Also in Java:
- Title
- java custom color
- Category
- Java
- Title
- java scanner input int
- Category
- Java
- Title
- java swing draw centered text
- Category
- Java
- Title
- java 8 hashmap example stackoverflow
- Category
- Java
- Title
- change brightness of image in java
- Category
- Java
- Title
- how to add a number to an array in java
- Category
- Java
- Title
- java previous permutation
- Category
- Java
- Title
- java execute for cycle parallel thread
- Category
- Java
- Title
- how to make a minecraft hacked client drawing the hud malicious intent
- Category
- Java
- Title
- jsonobject to java object
- Category
- Java
- Title
- java map declaration
- Category
- Java
- Title
- java string format .2f
- Category
- Java
- Title
- string to arraylist convert java
- Category
- Java
- Title
- osmdroid offline map does not show
- Category
- Java
- Title
- check if string is null or empty java
- Category
- Java
- Title
- java creare costante
- Category
- Java
- Title
- android create notification
- Category
- Java
- Title
- counting the number of characters in a string java
- Category
- Java
- Title
- java 8 loop in map
- Category
- Java
- Title
- regex get string between quotes java
- Category
- Java
- Title
- java get html from url
- Category
- Java
- Title
- split by new line java
- Category
- Java
- Title
- raise number to power java
- Category
- Java
- Title
- java script how to not allow soace
- Category
- Java
- Title
- arraylist add method
- Category
- Java
- Title
- how to declare string array in java
- Category
- Java
- Title
- java get keys from hashmap
- Category
- Java
- Title
- spigot repeating task
- Category
- Java
- Title
- java get first char
- Category
- Java
- Title
- scan a string using scanner class in java
- Category
- Java
- Title
- how to quicksort a string array in java
- Category
- Java
- Title
- validation list empty java
- Category
- Java
- Title
- final variables in java
- Category
- Java
- Title
- java resource file
- Category
- Java
- Title
- java final modifier on method
- Category
- Java
- Title
- java find item in list by property
- Category
- Java
- Title
- threadsafe singleton pattern in java
- Category
- Java
- Title
- recursion in java
- Category
- Java
- Title
- java getter
- Category
- Java
- Title
- loop through array java
- Category
- Java
- Title
- how to make javafx full screen default
- Category
- Java
- Title
- java integer to binary string
- Category
- Java
- Title
- create color object java
- Category
- Java
- Title
- how to calculate exponential in java
- Category
- Java
- Title
- resurce leak java
- Category
- Java
- Title
- arraylist to array java
- Category
- Java
- Title
- java stream sort Collator
- Category
- Java
- Title
- java count substring occurrences in string
- Category
- Java
- Title
- enum in java
- Category
- Java
- Title
- number to char java
- Category
- Java
- Title
- java string format with placeholder
- Category
- Java
- Title
- java taking console input
- Category
- Java
- Title
- java append to array
- Category
- Java
- Title
- java for in loop
- Category
- Java
- Title
- arraylist get last
- Category
- Java
- Title
- string to int java
- Category
- Java
- Title
- java loop through string
- Category
- Java
- Title
- java insert into arraylist
- Category
- Java
- Title
- java array check duplicates
- Category
- Java
- Title
- string replace last character java
- Category
- Java
- Title
- java check if file exists
- Category
- Java
- Title
- java function that returns the index of the largest value in an array
- Category
- Java
- Title
- java iterate through hashmap
- Category
- Java
- Title
- java random number in range
- Category
- Java
- Title
- google map set default zoom android studio
- Category
- Java
- Title
- java newinstance alternative
- Category
- Java
- Title
- java store hexadecimal value
- Category
- Java
- Title
- how to get array input in java
- Category
- Java
- Title
- programa que convierete un archi de c a java
- Category
- Java
- Title
- how to count an replace string in java
- Category
- Java
- Title
- abstract class java constructor
- Category
- Java
- Title
- how to reverse a list in java
- Category
- Java
- Title
- java split string
- Category
- Java
- Title
- close searchview android java
- Category
- Java
- Title
- java public static void main
- Category
- Java
- Title
- how to split a string in java
- Category
- Java
- Title
- casting java
- Category
- Java
- Title
- remove space string java
- Category
- Java
- Title
- spring data jpa inheritance repository
- Category
- Java
- Title
- login and logout react native and firebase
- Category
- Java
- Title
- creating thread in java example
- Category
- Java
- Title
- Linked List implementation
- Category
- Java
- Title
- how to get length of integer in java
- Category
- Java
- Title
- how to create a Rectangle in java
- Category
- Java
- Title
- Java's BigInteger class
- Category
- Java
- Title
- priority queue java reverse order
- Category
- Java
- Title
- treeset java descending order using comparator
- Category
- Java
- Title
- how to loop through an array
- Category
- Java
- Title
- java convert char to int
- Category
- Java
- Title
- how to create a Scanner Object in java
- Category
- Java
- Title
- remove action bar android studio
- Category
- Java
- Title
- taking date as input in java
- Category
- Java
- Title
- java get icon for file type
- Category
- Java
- Title
- list java replace
- Category
- Java
- Title
- java how to convert string to int
- Category
- Java
- Title
- capitalize string java
- Category
- Java
- Title
- Java create array of array
- Category
- Java
- Title
- array string java in one line
- Category
- Java
- Title
- javafx textarea how to make smaller
- Category
- Java
- Title
- how to add all list elements at once in java
- Category
- Java