Home >Java >javaTutorial >What does class name mean in java
Class name in Java
In Java programming, the class name refers to the name of the user-defined type. It is used to uniquely identify a class and represents a collection of specific objects, containing their shared data (fields) and behavior (methods).
Naming convention
There is the following naming convention for class names:
Employee
, Student
Class names and objects
The class name itself does not represent any object. To create an instance of an object, the keyword new
is used. For example:
<code class="java">Employee employee1 = new Employee(); Student student1 = new Student();</code>
Class Name and Inheritance
When a class inherits from another class, the class name of the child class contains the class name of the parent class. For example:
<code class="java">class Child extends Parent { // ... }</code>
Class name and interface
When a class implements an interface, the implements
keyword will be added after the class name, followed by The name of the interface. For example:
<code class="java">class Employee implements Comparable<Employee> { // ... }</code>
The role of class name in Java
The class name has the following role in Java:
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!