- Collection Framework in JavaCollections Class in JavaList Interface in Java with ExamplesArrayList in JavaVector Class in JavaLinkedList in JavaQueue Interface In JavaPriorityQueue in JavaSet in JavaHashSet in JavaLinkedHashSet in JavaMap in the JavaHashMap in JavaHashtable in JavaLinkedHashMap in Java
Nested if…else Statement
It is legitimate to home if-else constructs, which implies you can utilize one if or else if proclamation inside an alternate if or else if explanation. The syntax for using this construct Is as follows:
if (condition_1) {
//Execute if condition_1 is true
if (condition_2) {
//Execute if condition_2 is true
}
} else if (condition_3) {
//Execute if condition_3 is true
} else {
//Execute if all conditions are false
}
Sample Implementation:
public class myTest {
public static void main(string args[]) {
int i = 1;
if (i >= 1) {
System.out.println(“The
if construct is executing!”);
if (i == 1) {
System.out.println(“The nested
if construct is executing!”);
}
} else {
System.out.print(“The
else construct is executing!”);
}
}
}
This would create the accompanying result:
The if construct is executing!
The nested if construct is executing!