skip to Main Content

I m not able to find the problem so as the solution .need help stuck from 2days.

still there is problem

2

Answers


  1. Please remove semicolon after method name

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search