+ 2

Why is the answer for this question error?

In this code main (SL challenge) method is written withot public and static. It is not possible to start the progrm form here, but why error? I think it' possible to compile this code https://code.sololearn.com/cC2uT5etnGXn/?ref=app

17th Dec 2019, 9:16 PM
Atila Sabo
Atila Sabo - avatar
8 Answers
+ 2
I don't get an error. Just no output. You need the static void main method to run your code but of don't have one nothing will happens. And this makes sense because normally only one of your classes contains the main method.
17th Dec 2019, 9:49 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
The code runs, and has no output as the answer, so according to Atila Sabo the answer then is number 4. Code compiled and runs without output.
18th Dec 2019, 9:08 PM
Buhle 💃💃💃
Buhle 💃💃💃 - avatar
17th Dec 2019, 9:17 PM
Atila Sabo
Atila Sabo - avatar
+ 1
Thank you for your answers Denise Roßberg and Coder Kitten I think it's just the bad question! Code doesn't work, and should't work, but there is no error. I tried it in eclipse, compiler makes the class file but nothing happend. This is just a class with one method, and program can't start form there
18th Dec 2019, 2:54 PM
Atila Sabo
Atila Sabo - avatar
+ 1
Sorry, the link is just a screanshoot of challenge. There are 4 answers provided: 1. Compile time error 2. Code compiles but throws Runtime Exception 3. Hello 4. Code compiles and runs without output The correct answer is error Maybe I didn't understand the question....
18th Dec 2019, 4:06 PM
Atila Sabo
Atila Sabo - avatar
+ 1
Buhle thanks, I agree
19th Dec 2019, 12:10 PM
Atila Sabo
Atila Sabo - avatar
0
P.s. I think all answers are wrong!
18th Dec 2019, 2:56 PM
Atila Sabo
Atila Sabo - avatar
0
Coder Kitten thank you for nice comment with a lot of details
19th Dec 2019, 12:09 PM
Atila Sabo
Atila Sabo - avatar