Is Java a pure object-oriented programming language?

Asked 08-Dec-2017
Viewed 1026 times

1 Answer


0

Is Java a pure object-oriented programming language?

Is Java a pure object-oriented programming language?

The feature of a Pure Object-Object Oriented Programming Language is the one who treats each substance present inside the program as objects which do not back for the primitive data type which includes char, Boolean, int, float, etc.

Tailing about the feature to be fulfilled for becoming a pure object-oriented programming language:

  • Abstraction
  •  Inheritance
  • Data Hiding/Encapsulation
  • Polymorphism
  • Methods are the only way to that any sort of operations are eligible to perform
  • All Predefined types are objects
  • All User-defined types are objects

Now talking about is JAVA a Pure Object- Oriented Programming Language…

Well, Java being till now fulfilled the properties from 1-4 and 7 but the property number 5 and 6 is not been fulfilled by JAVA thus, an interpretation that JAVA is not an Object Oriented Programming Language. As it has these properties:

Primitive Data Type:

One of the very good examples Smalltalk of an Object-Oriented Programming Language in a similar fashion as C++ and JAVA are having no differences in between the values which are of primitive type or values which are of an object type. Thus, in Smalltalk values of Char, Boolean and Integer are also an object. In Java, predefined types are treated as nin-objects.

char a= ‘b’;
System.out.println(a);

Static Keyword:

When he announces a class as static then it can be utilized without the utilization of a object in Java. In the event that we are utilizing static function or static variable then we can't call that function or variable by utilizing dot(.) or class object opposing object-oriented element.


Wrapper Class:

The mechanism of interchanging object into primitive and primitive into an object. In JAVA, Character or Boolean etc. can be used rather a char, bool etc. Communication is possible using objects without involving methods.

 string s = "XYZ" + "X" ;

Notwithstanding utilizing Wrapper classes does not make Java an unadulterated OOP language, as inside it will utilize the operations like Unboxing and Autoboxing. So in the event that you make rather than int Integer and do any mathematical operation on it, under the hoods, Java will utilize primitive type int as it were.

public class BoxExam
{
public static void main(String[] args)
    {
            Integer a = new Integer(1);
             Integer b = new Integer(2);
            Integer c = new Integer(a.intValue() + b.intValue());
           System.out.println("Output: "+ c);
    }
}

Take this for a Run on IDE.

This interprets two errors which would not prove that JAVA is a pure OOPS:

1. during the creation of the Integer Class, a user has used primitive type ‘int’ that is number 1,2

2. When performing the addition of the numbers then also JAVA is using primitive type ‘int

Thus, clearly, it concludes that JAVA is not a Pure Object Oriented Programming Language...

Hope, this would have helped you!

Cheers!


Comment
Thanks for answering. - Anonymous User 22-Jul-2019