Find the error and correct it:
• if(x>=3)
System.out.println(“ number is equal to 3 “) ;
System.out.println(“ or number is greater than 3 “) ;
else
System.out.println(“ number is not greater or equal to 3 “) ;
public class IfElseStatement {
public static void main(String[] args) {
// condition x<3
int x = 2;
if (x >= 3) {
System.out.println(" number is equal to 3 ");
System.out.println(" or number is greater than 3 ");
} else {
System.out.println(" number is not greater or equal to 3 ");
}
}
}
Comments
Leave a comment