Rules associated with a Source code File declaration

1. One public class per source code.

2. Comments can appear any where in the code.

3. Name of file should match with the public class name. This is not necessary if a file only has non public class.

4. The order of statements in a class file are

  • package
  • import
  • public class name.

5. package and import statement apply to all classes in a source code file.

6. A source code file can have more than one non public class

In Category: Java, SCJP

Ravi Shankar

A Software developer and blogger who is always looking to provide technical help to the wider community.

Show 0 Comments
No comments yet. Be the first.

Leave a Comment

Get your free copies of the following tech guides by joining the Digital Answers mailing list.