2 Answers

Please remove semicolon after method name

the problem here is you put ; in the main function. and some minor changes to be fix.

to solve this here how look it is:

import java.util.Scanner;

public static void main(String[] args) {
 Scanner sc = new Scanner(System.in);
 int age = sc.nextInt();

 if (age > 18) {
  System.out.println("Adult");
 } else {
  System.out.println("Not Adult");
 }
}

best practice when you creating a file class it should be a PascalCase and followed by your class name also as PascalCase.

Related