+ 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
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.
+ 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.
+ 1
Question looks like this:
https://drive.google.com/file/d/18KKyQZYXns1C-_UvcN1QyqfnhzA68myk/view?usp=drivesdk
+ 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
+ 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....
+ 1
Buhle thanks, I agree
0
P.s. I think all answers are wrong!
0
Coder Kitten thank you for nice comment with a lot of details