Easy way to learn Classes And Object in Java

Classy Engineers
2 min readMar 23, 2021

Hello Everyone, Hope you are fine and eagerly waiting for our new blog😅. We have discussed Loops or iterators in our previous blog on Java. Now, we are going to move on to the most important OOP concepts in java. So, let’s gear up to uncover some prominent terms.

The first question that arises in mind is what is OOP’s concept? Here is your answer, OOP’s (object-oriented programming system) concept refers to languages that utilize objects in programming. OOP’s concepts play a significant role in making java to be stand alone in front of other different languages. With the help of classes and objects, it implements real-world entities like data hiding, encapsulation, inheritance, etc. that we will discuss in upcoming blogs. The fundamental idea of OOPs is to create objects and use them throughout the program.

Without wasting your precious time, Let’s get started with Java Classes and Objects Concept.

Class: We can say a class is like a template/a blueprint that contains all your data. A class contains fields (i.e variables) and methods to describe the behavior of an object.

Before going to understand the syntax of the class let’s see some naming conventions:

  • To write class-name we have to keep some rules in mind that it should be a noun and start with the upper case letter of each word (such as Civil, Mechanical, etc).
  • Method and variable name should be a verb and if the name holds multiple words then start it with lower case letter of the first word followed by an uppercase letter of each internal word(such as numberOfLockers and lockerName() )

However, these are not strict rules to follow but it is a standard way to represent them.

In the above code, the name of the class is Civil, numberOfLockers is the member

variable, and lockerName() is a method.

Now the thing is how can we access the class properties? So, Here comes a concept of an object by which you can access these variables and methods.

Object: Anything present in your surrounding which has state and behavior is called an object. An example of an object is a chair, pen, bike, etc. Also, an object is an instance of a class that can access your data and
To know more: https://classyengineers.com/easy-way-to-learn-classes-and-object-in-java/

--

--

Classy Engineers

Classy Engineers is a blog, where you can find concepts related to Lifestyle and Technology. 😊 Website link: https://classyengineers.com/