package com.java.myapp;
public class MyClass {
public static void main(String[] args) {
int i = 5;
if( i == 10 )
System.out.println("true statement i = 5");
if( i == 10 )
{
System.out.println("true statement i = 10");
}
else
{
System.out.println("false statement i <> 10");
}
}
}
Output
false statement i <> 10
Example 2
MyClass.java
package com.java.myapp;
public class MyClass {
public static void main(String[] args) {
boolean condition = true;
if (condition) {
System.out.println("Condition is true.");
}
else {
System.out.println("Condition is false.");
}
}
}