Submitting Answer - Java

What are codes included in submitting an answer written in Java? An example is very helpful.

I asked the question because my code cannot be compiled, though I was able to answer the very first practice exercise.

And just a follow-up question, could I submit an answer in OOP?

I went through your submissions for TEST, and most of your Java submissions are actually C++ code. Make sure you pick the right language when you submit. Otherwise, a compilation error will definitely come up.

Now, looking at this submission:, your class name is not “Main” (quotes for clarity). The sole reason for this is that’s what CodeChef looks for when it compiles your Java solution. If you are testing out this code on your computer, you are free to name it whatever you like. But, when submitting your solution, you must have your class name as “Main”.

To answer your last question, Java is only OOP; so, all your submissions are technically OOP. However, I’m assuming you mean “Can we create different classes and use them?” The answer is yes. But, all these classes must be in the same file; that is, you can only have one public class declaration in your submission.