×

# Additional check for Java class definition

 0 It would be great when Java solution is submitted to do simple grep before compiling it, if there is public class  definition in the code. If so, return error message that class cannot be public. Public classes are valid in language, but if I submit such solution I'm getting compilation error. For example there is such check on CodeForces.com (but class here has to be public contrarily). Almost in every contest I have at least one such submission :-( asked 27 Apr '12, 15:49 16.8k●49●115●224 accept rate: 11%

 0 Make sure that you are naming the file same as the name of the class declared as public. In Java, it is compulsory to name the file as same as the name of public class. answered 11 May '12, 14:14 0★appy2905 1●1●1●2 accept rate: 0% The problem is, that your class on CodeChef cannot be public... (16 May '12, 17:53)
 toggle preview community wiki
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Tags:

×903
×165