Java Tutorial
- Runtime
- java 21.0.12
- Files
- 60 files · 24 KB
- Runs
- 50 runs
- Published
package sessionSeven;import java.util.Scanner;public class NestedIfelseBlocks { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int age = sc.nextInt(); // 20 boolean hasLicense = sc.nextBoolean(); // false if (age >= 18) { // true if (hasLicense) // false System.out.println("You can Drive"); else System.out.println("Get a license first"); } else { System.out.println("Too young to drive"); } }}