0

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!"); } } } 
2
  • 2
    public static void main(String[] args) Main must have this signature which requires a String, not your custom object (you can change the variable name args to anything however). Also, see the other allowed signature from assylias's answer. Commented May 13, 2014 at 16:24
  • Change the arguments of your main to String[] args. Commented May 13, 2014 at 16:25

2 Answers 2

3

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

Sign up to request clarification or add additional context in comments.

Comments

2

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

public static void main(String[] args) 

Should fix your problem.

1 Comment

Its not of type String its of type String[]

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.