jeudi 23 avril 2020

getting Compilation error : "java:9: error: ';' expected"; i'm not able to understand where to put semicolon

I'm getting this compilation error:

Solution.java:9: error: ';' expected
     boolean isEVen(){
                   ^

import java.util.Scanner;

public class Solution {

public static void main (String[] args){

    Scanner s = new Scanner(System.in);

     int n = s.nextInt();

     boolean isEVen(){
         return n%2==0;
     }


       if (isEVen() && n<=5 && n>=2){
            System.out.println("Not Weird");
            }else{
            if(!isEVen()){

            System.out.println("Weird");

            }else{
                if(isEVen() && n>=6 && n<=20){

            System.out.println("Weird");

                } else{
                    if (isEVen() && n>20){

            System.out.println("Not Weird");

                    } 
                }
            }

            }
        }    
}

Aucun commentaire:

Enregistrer un commentaire