Why java is not pure object oriented programming language?

Learn: why java is not so pure object oriented language? Why java is not 100 % pure object oriented language? By Preeti Jain Last updated : January 14, 2024

What object oriented language is?

When we talk about everything in terms of objects. (i.e. data representation based on objects , methods representation based on objects).

Why java is not pure object oriented programming language?

Reason 1

Java is not pure object oriented it means we can represent data with or without objects (i.e. it is possible to represent few data without object means there is no need of object).

Case 1: Works without object

class WorkWithoutObject{
	public static void main(String[] args){
		int i = 5;
		System.out.println("value of i is " + i);
	}
}

Output

D:\Java Articles>java WorkWithoutObject
value of i is 5

Case 2: Work with object

class WorkWithObject{
	int i = 5;
	public static void main(String[] args){
		WorkWithObject wwo = new WorkWithObject();
		System.out.println("value of i is " + wwo.i);
	}
}

Output

D:\Java Articles>java WorkWithObject
value of i is 5

Reason 2

Java is not pure object oriented it means we can represent data with or without objects (i.e. it is possible to represent few data without object means there is no need of object).

int i = 5;
Integer i = 5;

Above the both cases results is same but only one difference first one is primitive types and second one is Object types.

Reason 3

We can represent static data directly there is no need of object instantiation (i.e. it does not mean that you can't create an object still we can create an object if required).

Reason 4

We can work with primitives and objects in java (java provides facility to represent data in terms of primitives or objects whatever you want).

Reason 5

Object contains variables and methods (i.e. we can call variable or methods with the help of dot operator that is not possible in case of primitives).

Reason 6

Primitives are not an object.



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.