Java Files
- File.java
All Java source code is named by a file with the extension of
.java
- Name.class
For each class defined in your code, the java compiler will produce
a file called Name.class where Name is the name of a class. It
is convention to name your main class application or applet
the same as the base filename in which it is contained. (e.g.
you have a class called SayHello, then it should be stored in
a file called SayHello.java)
- You can have at most one class in a file that is public!! This
must have the same name as the filename it is contained in.
Example Code