lundi 28 octobre 2019

Java illegal start of expression on if statement

I'm writing a program for class that's supposed to prompt users for a date and then enter a season. I keep getting an "illegal start of expression" error on the first if statement in the code and can't figure out why.

I checked for missing semicolons and other syntax errors but I didn't find anything.

  int month = keyboard.nextInt();
  int day = keyboard.nextInt();

  if ((month % 3 ==) && (day >= 21))
  {
     if (month <= 3)
        System.out.println("Spring");
     else if (month <= 6) 
        System.out.println("Summer");
     else if (month <= 9)
        System.out.println("Fall");
     else System.out.println("Winter");
  }
  else
  {
     if (month <= 3)
        System.out.println("Winter");
     else if (month <= 6) 
        System.out.println("Spring");
     else if (month <= 9)
        System.out.println("Summer");
     else System.out.println("Fall");
  } 

if ((month % 3 ==) && (day >= 21))

is the line that's causing the problem

Aucun commentaire:

Enregistrer un commentaire