Friday 1 September 2017

Public Class and Source File Name

Cited from the Book Java How to Program

A public class must be placed in a file that has the same name as the class (in terms of both spelling and capitalization) plus the .java extension; otherwise, a compilation error occurs. For example, public class Welcome must be placed in a file named Welcome.java.

Each class declaration that begins with keyword public must be stored in a file having the same name as the class and ending with the .java file-name extension.

No comments:

Post a Comment