Is Java Object Oriented or Not?

Learn via video course
FREE
View all courses
Java Course - Mastering the Fundamentals
Java Course - Mastering the Fundamentals
by Tarun Luthra
154546
5
Start Learning
Java Course - Mastering the Fundamentals
Java Course - Mastering the Fundamentals
by Tarun Luthra
154546
5
Start Learning
Topics Covered

Don't get confused, but Java is NOT a PURE OBJECT ORIENTED programming language. The reason is that seven qualities must be satisfied for a programming language to become purely Object-oriented.

Those are the following qualities:-

  1. Encapsulation/Data Hiding
  2. Inheritance
  3. Polymorphism
  4. Abstraction
  5. All predefined types needed to be objects.
  6. All user-defined types needed to be objects.
  7. All operations executed on objects must occur only through methods exposed to the objects.

Java supports many qualities from the above list. Still, it doesn't satisfy the qualities such as:

  • "All predefined types needed to be objects" and
  • "All operations executed on objects must occur only through methods exposed to the objects"

Java is considered an object-oriented programming language as it supports the core principles of object-oriented programming, such as encapsulation, inheritance, abstraction, and polymorphism. However, it may not satisfy all the qualities of object-oriented programming to the same extent as other languages such as Smalltalk or Ruby.

Introduction to Object-Oriented Language

Object-oriented programming is a computer programming philosophy or methodology that organizes/models software design around data or objects rather than functions and logic. It is a model built around objects and considers the objects and classes as its main components.

Object-Oriented Language aims to implement all the real-life concepts like inheritance, polymorphism, abstraction, and encapsulation in the Language.

Object-oriented Language has various advantages:

  • It is faster and more manageable to execute
  • It provides a clear structure for the programs and makes the codebase maintainable.
  • It allows us to keep the Java code DRY "Don't Repeat Yourself," and makes the codebase easier to maintain, modify and debug
  • It allows the creation of fully reusable applications with less code and shorter development time.

Points to Remember:-

  • Everything is an object
  • Every object is an instance of a class.
  • The class includes the attribute and behavior associated with an object.

The above points help you to understand why java is not a pure object-oriented language.

Why Java is Not a Purely Object-Oriented Language?

Look at the list of seven qualities. In that case, Java supports the 1, 2, 3, 4, and 6, which means it supports Encapsulation at the class and package level, Abstraction, Inheritance, and Polymorphism user-defined types are also objects.

But when it comes to the support of 5 and 7, Java fails because all predefined types are not objects in Java. After all, you can define primitive types ( int, long, bool, float, char, etc.), which also causes the violation of number 6 quality.

Smalltalk is significantly recognized as the purest form of an object-oriented programming language because primitive values such as integers, booleans, and characters are also objects.

The Primitive Data Types

Java doesn't satisfy the quality of all the predefined data types needed to be the objects because the primitive data types, such as int, bool, float, etc are the type of non-objects.

Example:-

Learn More

Conclusion

  • The Java language is not pure object-oriented because it doesn't satisfy all the requirements of an object-oriented language.
  • To become pure object-oriented language, seven qualities must be satisfied.
  • Smalltalk is recognized as a pure object-oriented language.
  • Java is not purely Object Oriented because it still supports primitive data types that violate the OOPs philosophy.