//if else if Statement
class Ifelseif
{
public static void main(String[] args)
{
int x=30;
if(x==10)
{
System.out.println("Value of x is 10");
}
else if (x==20)
{
System.out.println("Value of x is 20");
}
else if(x==30)
{
System.out.println("Value of x is 30");
}
}
}
Output:-
Value of x is 30
Previous Next
class Ifelseif
{
public static void main(String[] args)
{
int x=30;
if(x==10)
{
System.out.println("Value of x is 10");
}
else if (x==20)
{
System.out.println("Value of x is 20");
}
else if(x==30)
{
System.out.println("Value of x is 30");
}
}
}
Output:-
Value of x is 30
Previous Next
No comments:
Post a Comment