Java-Object Oriented Programing

Basic concept of object oriented programming.

Gimsara kulathunga
3 min readApr 6, 2020

Hello friends, in this article, I am going to discuss with you the basic concepts of object oriented programming with java. Java is an object oriented programming language.So, everything in java is associated with objects and classes.Not only that it also combined with attributes and methods.

First of all, will see how to create custom classes and objects in your java program.So, let’s go to the topic.

Classes and Objects.

  • What is the “class”?

Class is a collection of objects or set of objects.

Therefore, we can say, the class is a blueprint of objects.

  • How to create a “class”?

We use the vehicle for a class name and set doors for a variable:

Create a class

According to the international standard, when we write the first letter of the class name, it should be a capital.Then, we can understand easily whether is it a class or object?.

  • What is an “object”?

Object is an instance of class. Therefore, object is an entity which has state and behavior.

EX: chair, pen, table, keyboard

It does not matter whether your object is physical or logical.According to the objects in the class, it can share common attributes(variables) and behaviors(methods).

  • How to create an “object”?

We create an object for a car and a bus.

Create an object.
  • How to create an object and class together and get an output?
Source code
Output

These are the basic things of object oriented programming and that you need to know, because you cannot understand OOP concepts without knowing basic things.

The next chapter, I wish to bring you about the inheritance.

Think…

“Knowing is not enough; we must apply. Willing is not enough; we must do.” — Johann Wolfgang V on Goethe.

--

--

Gimsara kulathunga

Undergraduate at the Faculty of Information Technology, University of Moratuwa. Chairman of IEEE Computer Society in University of Moratuwa.