Home » Java programming language

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?
Submitted by Preeti Jain, on February 02, 2018

1) First we will understand 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).

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).

Case 1: Works without object

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


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);


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

3) Java is not pure object oriented programming language just because of primitive data types like byte, short, int, char, float, double, long, boolean etc. we can work with primitive type if we don't want to work with Object type.

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.

4) 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).

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

6) 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).

7) Primitives are not an object.

Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.