Learn Pain Less

HomeOur TeamContact
Java
How to create Class in JAVA (Beginners)
Pawneshwer Gupta
Pawneshwer Gupta
March 19, 2015
1 min
How to create Class in JAVA (Beginners)

Hello dear readers !!!

In last post I have written about types of JAVA Classes and we have studied about JAVA’s built in classes and User Defined classes. So in this lesson I will teach you that how to create classes in JAVA.

below is Syntax of creating JAVA Class :

class CLASS_NAME{
}

In this syntax, “class” is a keyword to create JAVA Class and its in small characters. “CLASS_NAME” is name of class which you want to create. The basic Naming Convention of JAVA class is First character of each word should be in Capital letters. for example :

“HelloWorld”,“Test”,“Hello”,“World”. etc

if you not wrote first letter in Capital then there is no issue of error. but this Naming Convention is to easily understand/find JAVA classes. for example if your program has 500 lines, and you are checking your code then you can easily point out that which are classes in that program.

example of creating class in JAVA :

class HelloWorld{
public static void main(String[] args){
System.out.println("Just Testing ...");
}
}

So this is simple example of creating Classes in JAVA programming language. In this example you can easily point out that “System” and “String” both are classes, because they are written in First Capital and remaining in small letters. but if you think that “Just Testing” are also classes then you are wrong, they are String, because they are written in double qouts.

and “public”,“static” these are special keywords which are used to define anything. in this example they are defining that “main” is public and static. I will explain what is “public” and “static”, in next upcomming lessons.

Subscribe to our newsletter!

We'll send you the best of our blog just once a month. We promise.

Tags

startclasscreate class

Share


Pawneshwer Gupta

Pawneshwer Gupta

Software Developer

Pawneshwer Gupta works as a software engineer who is enthusiastic in creating efficient and innovative software solutions.

Expertise

Python
Flutter
Laravel
NodeJS

Social Media

Related Posts

Working with Files, Folders java
Working with Files, Folders java
March 25, 2015
1 min
Learn Pain Less  © 2024, All Rights Reserved.
Crafted with by Prolong Services

Quick Links

Advertise with usAbout UsContact Us

Social Media