#20 How to Write Program using Nested if in java ? Java me Nested if क्या होता है ?
package com.sudhirtheindian2.java123;
public class nested_if_else {
public static void main(String[] args) {
// How to write a program using nested if else
// Whenever we define if else block inside another if else
// block called nested_if_else
// syntax
// if(condition 1)
// {
// if(condition 1A){
//
// }
// else{
//
// }
//
// }
// else{
//
// if(codition 2){
//
// }
// else{
//
// }
// }
// greatest number find among 3 number program
int a=20,b=30,c=10;
if(a>b){
if(a>c){
System.out.println("maximum number is :"+a);
}
else{
System.out.println("maximum number is :"+b);
}
}
else {
if(b>c){
System.out.println("maximum number is :"+b);
}
else {
System.out.println("maximum number is :"+c);
}
}
}
}
टिप्पणियाँ
एक टिप्पणी भेजें