Is Java a Pure Object Oriented Programming Language?

One of the oldest question related to Java is whether Java a pure object oriented language or not?Short answer is no, There are many things in Java which are not objects e.g. primitive data types e.g. boolean, char, short, int, long, float, double, different kinds of arithmetic, logical and bitwise operator e.g. +, -. *, /, &&, || etc. Few pure OO languages are Smalltalk and Eiffel. Though Java is one of the most successful Object oriented programming language, which also got some functional programming touch in Java 8 is never considered 100% or pure object-oriented programming language. If it were, all its primitives would be objects. It actually moves half-way in this direction with String (and perhaps Array), but it doesn't quite go far enough. Actually, one could argue that as String and Array aren't inheritable, that makes those parts of Java at best object-based.

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.

Why Java is not Pure Object Oriented language? 

Is Java Pure Object Oriented Programming LanguageSmalltalk is often considered one of the purest Object oriented language and comparing Java with Smalltak will give you sufficient reasons, why Java is not 100% object oriented language. Following point makes sense to me.

1) Primitive data types are either stored directly in fields or on the stack rather than on the heap. This is the reason Java is not considered a pure OO programming language

2) If we have to classify in "pure OO" or "non-pure OO" we have a problem. It’s better to talk about "purity levels". Smalltalk has a higher purity level than Java. "Primitive types" in Smalltalk are actually "Primitive Classes" and in Smalltalk all "procedures" or "functions" are really messages

On closing notes, You can make your program pure object oriented by using Autoboxing, but Java compiler supports primitive data types, so Java cannot be Pure object oriented unless it makes everything in terms of objects. In short, Java is not pure object oriented programming language because it supports primitive data types and everything is not object in Java. Let me know what is your thought on this, do you consider Java pure object oriented language? If not, can you think of reasons due to which Java is not 100% object oriented language?
Further Learning
SOLID Principles of Object Oriented Design
Absolute Introduction to Object Oriented Programming in Java
Java - Object Oriented Programming [For Absolute Beginners]


  1. The most important reason that java isn't OO, in practice, is the overwhelming use of DataObject/ActionObject bifurcation. It's just FORTRAN with lower case syntax.

  2. Actually, the way to go for a programming language is to mix various programming paradigms. For example Java is now an object-oriented language with elements of functional programming.

  3. Since primitive types are heavily used in the Application making them object degrades the performance of the application as Objects are heavy compared to primitive types .So It is a good decision from the java guys to not to make primitive types as objects.

  4. "making them object degrades the performance of the application as Objects are heavy compared to primitive types"

    not necessarily true. It just pushes the burden of optimization to the programmer. Making them syntactically an object and then letting the compiler optimize them to primitives is a far more productive (and potentially less error prone) way to achieve this c.f. scala where all types are considered "objects" but where possible the compiler implements the code using primitives automatically.

  5. Java support wraper class so how u say java is not purely object oriented? reply me aon

    1. because even though there are wrapper classes, the primitive types still are there.
      also, the use of static is not OO . you can call methods and use variables without having an object.

  6. oh god, what the hell ??? is it very important whether java is a pure OO language? java is cross os platform and easy to learn , so we can implement an application rapidly, and we dont have to consider the cross os issue. i think this is the key point.

  7. I think so Tom! and that's what really matter.

  8. Hi @Tom and @Reynier silverio, this question is mainly for purist, but some interviewer do prefer to ask, why Java is not a pure object oriented language or which language is considered as purest object oriented language etc. It's a topic of discussion, but things happens.

  9. But java supports Autoboxing which clearly box primitive to wrapper, then how could it stops java from being pure Object oriented. Somebody please make this concept clear to me.

    1. @Unknown, there are many things in Java which are not as per object oriented programming concept e.g. static variable. In Pure OOP, every thing should be object, nothing should belong to class.

  10. Even if we have primitives, java will do Autoboxing by itself. So primitives will be converted to Objects. How it is violating OO concept.

  11. right now java is a pure object oriented or not

  12. Java is not a pure Object Oriented Language! It's because it supports primitive data types. Moreover, it does not support some features like operator overloading and multiple inheritance.

  13. The Straight answer is Yes, Java is Object Oriented.
    Without creating classe(s) and/or Object(s) we cannot achieve any functionality in java.
    That's why the makers of java told EVERYTHING IN JAVA IS OBJECT.