Guide to Object-oriented Programming With Java (Buffalo State University Version)
Chapter 3: Naming Packages and Classes
Naming Conventions
A Java package is a "container" for your Java classes. Your packages
should be named as follows (put-your-username-here
should be all lowercase with no space or apostrophes):
edu.buffalostate.cis425.fa10.exercises..put-your-username-here;
So, the first line of every .java
file should be:
package edu.buffalostate.cis425.fa10.exercises..put-your-username-here
;
Each Java program can contain only one (1) class
method. The name of the class must begin with an Uppercase letter. The name of your .java
file should be the same as the name of your class. For example, the file HelloWorld
would have a public class HelloWorld { }
statement.
A Sample java
Program
Every Java program should start with the package
line. Next you would have any import
statements, the class
line, any class variables, then class methods, and finally the main() method.