Java OOP


Java - What is OOP

OOP stands for Object-Oriented Programming.

Process planning is about writing processes or methods that perform tasks in data, while object-focused planning is about creating objects that contain both data and methods.

Object-oriented planning has fewer benefits than process planning:

  • OOP is fast and easy to use
  • OOP provides a clear framework for programs
  • OOP helps keep Java Dry code "Do not duplicate", and makes the code easy to save, correct and debug.
  • OOP makes it possible to create fully reusable applications with minimal code and short upgrade time

Tip: The "Do Not Repeat" (DRY) policy is about reducing code duplication. You should extract the standard application codes, and place them in one place and reuse them instead of repeating them.


Java - What are Classes and Objects?

Classes and objects are two main elements of an object-focused program.

Look at the following picture to see the difference between class and objects:


class

Fruit

objects

Apple

Banana

Mango


Another example:


class

Car

objects

Volvo

Audi

Toyota


So, the class is a model of things, and the object is a model of the class.

When each item is created, it benefits all sorts and styles from the classroom.