Back to articles
What is Class in Java?

What is Class in Java?

via Dev.to TutorialDivya Divya

A class is a blueprint used to create objects by defining their properties and behaviors. Blueprint: A class is called a blueprint because it defines the structure and behavior for objects, but does not create any object itself. It’s like a template. Variables => (Properties / Data) Methods => (Functions / Actions ) Example : Car: Properties => (Color , model , Speed) Actions => (Star() , Stop() ) This one class , You can create many Objects Class Rules: Starts with a Uppercase letter: Example: BankAccount Meaningful Name: Example: UserProfile Don't use the Special Charecters: Except _ and $ it's technically allowed but using avoid. Example: StudentData Student_Data ❌ File Name = Class Name: Must match the File Name and Class Name. Example: public class Home{ } **File Name:** Home.java Do not use reserved keywords: Java already have a keywords with a meaningful so they cannot be used class names , variable names , or method names. Common Java Keywords: int class if else for while stati

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
6 views

Related Articles