You are not logged in. Please login at to post your questions!


Additional check for Java class definition

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 (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

betlista's gravatar image

betlista ♦♦
accept rate: 11%

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

appy2905's gravatar image

accept rate: 0%

The problem is, that your class on CodeChef cannot be public...

(16 May '12, 17:53) betlista ♦♦

Return blunder message that class can't be open. Open classes are substantial in dialect, hire someone to write college essay yet in the event that I submit such arrangement I'm getting aggregation mistake.


answered 07 Oct '16, 12:21

rocky124's gravatar image

accept rate: 0%

A class the fundamental building piece of an object oriented language, for example, UK Help Services - Assignment Ninja Java is a format that depicts the information and conduct connected with occasions of that class.


answered 11 Jan, 17:21

jhons's gravatar image

accept rate: 0%

Physical pain is less torch able than compare to other comment database sql books


answered 06 Feb, 15:41

deepakkumare's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • 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



Asked: 27 Apr '12, 15:49

Seen: 1,782 times

Last updated: yesterday