Quick Index
Overview
Class Names
File Names
Overview
Java class names use camel case (bumpy) which simply means the first character of each word is capitalized.
Note that
spaces are not allowed
in any of the names.
Also see
alphanumeric
Class Names
Rules
First character -- Uppercase letter or underscore allowed (digit not allowed)
Remaining characters (beyond first) -- Alphanumeric character or underscore allowed (digits allowed)
Examples of Valid Class Names
Rectangle
Rectangle2
RectangleSet
Note: Underscores are allowed but generally not used
Examples of Improper Class Names
2Rectangle
rectangle
Rectangle Set
Rectangle-Set
Rectangle&Set
File Names
Rules:
For a public class, the filename must match the class name
The file extension must be ".java"
Examples:
For the public class
Rectangle,
the filename would need to be
Rectangle.java
For the public class
SpaceShip,
the filename would need to be
SpaceShip.java
Introduction To Objects With Java (Chapter 302 - Classes)
Chapter 302 - Classes
Naming Java Classes and Filenames
Chapter Contents
Overview
Naming
Example
Coding
Compiling
Header
Body
Refs
Challenge
Chapter
Top
Search
TOC