Java Reference
In-Depth Information
2. if else statement
In case the if condition is true then the statements inside curly brackets of if block is
executed otherwise statements of the else block are executed.
If(condition)
{
if condition is true, these statements will be executed.
}
else
{
in case the condition given in if statement is false , these statements will be executed.
}
these statements are executed always.
Program
public class if-elsestatement
{
public static void main(String args[])
{
int test1=10;
if (test1>10)
{
system.out.println(“you are wrong”);}
else
{
System.out.println("good");
Search WWH ::




Custom Search