Why Java is not a Pure or Fully Object-Oriented Programming Language?

In this article, we will take a look into why Java is not a 100% purely or fully OOPS (Object-Oriented Programming) language?

Seven Qualities

There are seven qualities to be satisfied for a programming language to be purely Object Oriented:

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

Java supports qualities 1, 2, 3, 4, and 6 but fails to support qualities 5 and 7 as shown in the below diagram:


Why Java is not a Pure or Fully Object-Oriented Programming Language?

Well, Java is not a pure OOP language due to two reasons:

Primitive Data Types:

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, and double which are not objects. These primitive data types can be used without the use of any object. 

For example:
public class IsJavaFullyOOPS {
    public static void main(String[] args) {
        int i = 10;
        byte b = 20;
        short s = 30;
        long l = 100L;
        double d = 100.10;
        float f = 200f;
        boolean flag = true;
        char c = 'R';
        System.out.println(i);
        System.out.println(b);
        System.out.println(s);
        System.out.println(l);
        System.out.println(d);
        System.out.println(l);
        System.out.println(d);
        System.out.println(f);
        System.out.println(flag);
        System.out.println(c);
    }
}
Output:
10
20
30
100
100.1
100
100.1
200.0
true
R
Even using Wrapper classes does not make Java a pure OOP language, as internally it will use the operations like Unboxing and Autoboxing. So if you create instead of int Integer and do any mathematical operation on it, under the hoods Java is going to use primitive type int only.

Static Keyword:

The second reason is related to the static keyword. In a pure object-oriented language, we should access everything by message passing (through objects). But Java contains static variables and methods that can be accessed directly without using objects.

For example:
public class IsJavaFullyOOPS {
    private static String message = "hello";
    public static void main(String[] args) {
        
        // calling message instance variable without object
        System.out.println(message);
        
        // calling demo static method without object
        demo();
    }
    
    private static String demo(){
        return "hello from method";
    }
}

YouTube Video

Watch the below YouTube to understand more why Java is not a Pure or Fully Object-Oriented Programming Language:

Comments