I am starting on the next chapter "Object-Oriented programming. So for fun I closed the book and tested my self on smoe of what I learned in the last chapter. For the most part I seem to be remembering what I have read except for this, which I typed for fun. When I try to complie this in the Terminal it comes back saying "ELSE without IF", but I do have the else without if.
It is only giving me that error and I can;t seem to understand why. I would be thankful if someone could shead some light on this for me.
Thank you.
-Lars
Code:
import java.util.*;
public class cards
{
static Scanner sc = new Scanner(System.in);
public static void main(String [] args)
{
System.out.print(" should we play: ");
int g = sc.nextInt();
{
if (g.EqualIgnoreCase("Y"));
System.out.println("OK then, lets play");
else if (g.EqualIgnoreCase("N"));
System.out.println("See ya");
}
}
}
It is only giving me that error and I can;t seem to understand why. I would be thankful if someone could shead some light on this for me.
Thank you.
-Lars