Java Reference
In-Depth Information
4. Nested if…else statement
When there are a series of decision, then we have to use a number of if-else statements in
nested form.
if( condition1){
//Executes when the condition 1 is true
if( condition2){
//Executes when the condition 2 is true
public class Test1 {
public static void main(String args[]){
int a = 30;
int b = 10;
if( a >10 ){
if(a== 30)
system.out.println(” a is equal to 30”);
system.out.println(“ a is not equal to 30”);
System.out.print("a is less than 10");
Search WWH ::

Custom Search