tccmobile
9/21/2017 - 4:20 PM

AssertionExample.java

import java.util.Scanner;

class AssertionExample{
    public static void main( String args[] ){

        Scanner scanner = new Scanner( System.in );
        System.out.print("Enter ur age ");

        int value = scanner.nextInt();
        assert value>=18:" Not valid";

        System.out.println("value is "+value);
    }
}