The class keyword in Java programming language
We will describe in this tutorial about The class keyword in Java programming language
In Java programming language, the class is a keyword in Java which is used to declare a new class which is a collection of related variables and methods
the class is a very important concept and basic building block of java
Declaration
Syntax
the syntax of the declaration of a class given below
[access-modifiers] class [identifier] { [class body] }
Example
class Class_Name { //properties or data members //methods or constructor }
Example for usage of the class keyword
we can use create a class using the class keyword
public class human{ int age; //variable or data type as integer String name; //variable or data type as String void walking(){ //method 1 } void driving(){ //method 2 } }
Program 1
public class human{ int age; //variable or data type as integer String name; //variable or data type as String void walking(){ //method 1 } void driving(){ //method 2 } human(){ //constructor } }
There are other Java language keywords that are similar to this keyword
Suggested for you
Usage of this statement in the Java language