package controlstructuresdemo;
import [Link];
public class SimpleControlStructure {
public static void main(String[] args) {
Scanner input = new Scanner([Link]);
// if-else structure
[Link]("Enter your age: ");
int age = [Link]();
if (age >= 18) {
[Link]("You are eligible to vote.");
} else {
[Link]("You are not eligible to vote.");
// switch structure
[Link]("\nChoose an option:");
[Link]("1. Say Hello");
[Link]("2. Say Goodbye");
int choice = [Link]();
switch (choice) {
case 1:
[Link]("Hello!");
break;
case 2:
[Link]("Goodbye!");
break;
default:
[Link]("Invalid option.");
// for loop
[Link]("\nCounting from 1 to 5:");
for (int i = 1; i <= 5; i++) {
[Link](i);
[Link]();