package com.mycompany.agevalidity; import java.util.*; public class AgeValidity { public static void main(String[] args) { Scanner sc = new Scanner(System.in); boolean duage = false; System.out.print("Age: "); int age = sc.nextInt(); System.out.println("Age: " + age); if (age < 18) { duage = true; } System.out.println("driving underaged: " + duage); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter