Why is Java not a pure object oriented language?

lella keerthi
3 min readOct 1, 2021

Object oriented programming (OOP) language uses an object-oriented programming technique that binds related data and functions into an object and encourages reuse of these objects within the same and other programs. Many languages are Object Oriented and there are seven qualities to be know more at JAVA online training satisfied for a programming language to be pure Object Oriented. They are:

  1. Encapsulation/Data Hiding
  2. Inheritance
  3. Polymorphism
  4. Abstraction
  5. All predefined types are objects
  6. All operations are performed by sending messages to objects
  7. All user defined types are objects.

Java is pure object oriented or not?

There are lot of arguments around whether Java is purely object oriented or not. Java is not a pure OOP language due to two reasons:

The first reason is that the Object oriented programming language should only have objects whereas java contains 8 primitive data types like char, boolean, byte, short, int, long, float, double which are not objects. These primitive data types can be used without the use of any object. (Eg. int x=10; System.out.print(x.toString());)

The second reason related to the static keyword . In pure object oriented language ,we should access everything by message passing (through objects). But java contains static variables and methods which can be accessed directly without using objects. That means, when we declare a class as ‘static’ then it can be referenced without the use of an object. know more at Java training

Is Java is Pure Object-Oriented language?

There are seven qualities to be satisfied for a programming language to be pure Object Oriented. They are:

1. Encapsulation/Data Hiding

2. Inheritance

3. Polymorphism

4. Abstraction

5. All predefined types are objects

6. All operations are performed by sending messages to objects

7. All user-defined types are objects.

If you look at these seven qualities, Java does satisfy most of them. Java supports Encapsulation at class and package level, It supports Abstraction, Inheritance, and Polymorphism, and all user-defined types are also objects.

What it doesn’t support is #5, all predefined types are not objects in Java, because you can define primitive types. This means it also violates #6. That’s why Java is not a pure object-oriented language.

If you want to learn more about Object-Oriented Design in Java, you can further check out Java Fundamentals: Object-oriented Design course on Pluralsight, it’s free for one month in April, make most of that time to go through this course.

Why Java is not a Pure Object-Oriented language?
Smalltalk is often considered one of the purest Object-oriented languages and comparing Java with Smalltalk will give you sufficient reasons, why Java is not 100% object-oriented language. The following point makes sense to me.

On closing notes, You can make your program pure object-oriented by using , but the Java compiler supports primitive data types, so Java cannot be Pure object-oriented unless it makes everything in terms of objects. know more at JAVA online training in Hyderabad

In short, Java is not a pure object-oriented programming language because it supports primitive data types and everything is not an object in Java.

Let me know what is your thought about this, do you consider Java a pure object-oriented language? If not, can you think of reasons due to which Java is not a 100% object-oriented language?

--

--