The class name in Java uniquely identifies the class. It must start with a capital letter, and the first letter of subsequent words must also be capitalized. It can only contain letters, numbers, underscores and dollar signs. It cannot have spaces or special characters. It cannot be used in Java Reserved words should reflect the category purpose and function. It is recommended to use camel nomenclature (for example: CustomerInformation).
Class name in Java
The class name in Java represents the identifier of a class and is used for uniqueness to identify this class. Class names must adhere to the following rules:
The meaning of class names
The class name should reflect the purpose and function of the class, making it easy to understand and identify. For example:
Customer
class represents customer information. Employee
class represents employee information. Book
class represents book information. Naming Convention
Java programming convention recommends using Camel-Case to name classes. In this convention:
For example: CustomerInformation
class.
Example
The following are examples of valid Java class names:
Student
BookstoreManager
ShoppingCart
$Util
_Helper
Invalid class name example
123
(cannot start with a number)customer
(The first letter must be capitalized) cat dog
(Cannot contain spaces) *Info
(Cannot contain special characters) static
(a Java reserved word)The above is the detailed content of What does class name mean in java. For more information, please follow other related articles on the PHP Chinese website!