Reves1992
Reves1992

Reputation: 5

Beginning Java Programming in Eclipse

Below is my code so far. I know there is something really really trivial that I am missing. I am a beginner C++ programmer as well but still do not have much experience in that language either.

I just want this to print out if I have made the mark or not. Next I will ask for an input from the command prompt and respond accordingly. Right now the command prompt opens when I click run and that is it... No lines printed! Also there are no errors...

public class CheckPassFail {
    public static void main(CheckPassFail[] args){
        int mark=88;
        System.out.println("The mark is " + mark);

        if(mark >= 50){
            System.out.println("You Passed!");
        } 
        else{
            System.out.println("You Failed!");
        }
    }
}

Upvotes: 0

Views: 96

Answers (2)

assylias
assylias

Reputation: 328923

The signature of main has to be one of:

public static void main(String[] args)
public static void main(String... args)

See also: https://stackoverflow.com/a/18194838/829571

Upvotes: 3

heptadecagram
heptadecagram

Reputation: 898

public static void main expects its arguments to be of type String:

public static void main(String[] args)

Should fix your problem.

Upvotes: 2

Related Questions