dimanche 27 septembre 2015

Error "else" without "if"

I have this program set up and i need help with 2 errors that i am getting

import java.util.Scanner;

public class EvenOdd { 
    public static void main(String[]args) {
        Scanner keyboard = new Scanner (System.in);
        System.out.print("---EvenOdd--- /n");
        System.out.printf("Enter a whole number: ");
        c = in.nextInt();
    }

    public static EvenOdd (int num) {
        int c = num;

        if (int.class) 
            (c/2)*2 = c;

        System.out.println("is even.");

        else (c)
            System.out.println("is odd");

        return EvenOdd;
    }
}

C:\Users\Desktop\EvenOdd.java:28: error: not a statement
else (c)

C:\Users\Desktop\EvenOdd.java:28: error: 'else' without 'if'
else (c)

2 errors

Aucun commentaire:

Enregistrer un commentaire