Why is Java not a Purely Object-Oriented Language

Why is Java not a Purely Object-Oriented Language?

Table of Contents

Introduced to this world in 1995 by Sun Microsystems, Java is a programming language built around OOP. In fact, Java is touted to be the ideal way to learn OOP. There is a huge fan base for Java and considered to be evergreen and one of the most preferred OOP languages in the IT world. Then what is this buzz surrounding Java that it is not purely object-oriented programming language? Let’s look at the claim closely and figure out the truth behind it.

Perceptions apart, for Java programming online training, consider H2K Infosys, the market leader in providing IT training to learners across the world.

Principles of OOP

A pure OOP Language is supposed to follow the below-mentioned principles

  1. Encapsulation – This property dictates that all the data is hidden under a specific head.
  2. Polymorphism – This concept of OOP that enables the existence of a single entity in multiple forms. This can be achieved through method overloading and method overriding.
  3. Inheritance – This concept ensures that an object acquires all the properties of a parent class which it extends. Instead of creating a new class, all the properties of the parent class such as methods and variables can be extended to the child class and can be used.
  4. Abstraction – By virtue of this property of OOP, only the necessary data is exposed to the end-user, hiding the unconcerned data from them. This is achieved through interfaces and abstract classes.
  5. All predefined types are objects
  6. All user-defined types are objects
  7. All operations are performed by sending messages to objects

So, is Java not a pure OOP language?

Point 5 fails: Smalltalk is a pure OOP language as all the predefined data types such as integers, Booleans, and characters are also objects unlike in Java. In Java, the primitive data types like int, char, long, bool, float, are not objects but the wrapper classes Integers, Character, and Float are. These wrapper classes have the right to convert primitive data types to objects. This means that all the predefined (primitive) types are not objects. This contradicts point 5 of OOP principles.

Point 7 also fails in Java: Whenever a class is declared as static, it need not be instantiated in Java. The entities in that class can be accessed using the class name (.)variable without the use of the object of a static class. This means point 7 is contradicted.

Verdict: When two of the principles of pure object-oriented programming concepts fail, Java is not considered pure OOP language.

Enroll for our 80+ hours comprehensive program at www.h2kinfosys.com for Java online course certificate.

2 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this article
Subscribe
By pressing the Subscribe button, you confirm that you have read our Privacy Policy.
Need a Free Demo Class?
Join H2K Infosys IT Online Training
Enroll Free demo class