DEV Community

Arshad Ali
Arshad Ali

Posted on

JAVA- IF Statement

public class Main {

    public static void main(String[] args) {

        //if Statement = perform a block of code if it's condition evaluates to be true

        int age = 75;

        if(age==75) {
            System.out.println("ok Boomer!");
        }
        else if(age>=18) {
            System.out.println("You are an adult");
        }
        else if(age>=13) {
            System.out.println("You are a teenager!");
        }
        else {
            System.out.println("You are not an adult");
        }

    }


}



Enter fullscreen mode Exit fullscreen mode

Top comments (0)