简体   繁体   中英

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!");
        }
    }
}

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

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

public static void main(String[] args)

Should fix your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM