Is Java An Object-Oriented Language or Not?

1. Objective

In this Java tutorial, we are going to learn about Is Java An Object-Oriented Language or not, if yes so why Java is not purely an Object Oriented Language.

So, let us start to get an answer of “Is Java An Object-Oriented Language or not”?

Is Java Object orientated Language

Why Java is not a purely Object-Oriented Language

2. Object Oriented Language

An purely Object Oriented Language or Complete Object Oriented Language are Fully Object Oriented Language which supports or have highlights which regards everything inside the program as articles. It doesn’t support primitive datatype(like int, char, bool, and so on.).

An OOP has these following characteristics –

  • Data hiding/ encapsulation
  • Inheritance
  • Abstraction
  • Polymorphism
  • All objects of the predefined type
  • All objects of user defined type
  • Only the method exposed to object should be performed on it

Let’s Revise Features of Java Programming Language

3. Reasons For Why is Java An Object-Oriented Language

Java doesn’t support the fifth and the last point, thus, not being a purely Object Oriented Language.

a. Primitive Data Type

An example of a purely Object Oriented Language is Smalltalk, it is unlike C++, and Java there happens no difference between values that are object and values that are primitive data types, in Java we treat predefined data types as non-objects. Primitive data types in Java are also treated as objects in Smalltalk.

Example –

  int a = 5;
System.out.print(a);

b. The static keyword

In Java a class declared as static can be used as without the use of object. We cannot call that function or variable using a dot(.).

c. Wrapper Class in Java

Wrapper class in Java, gives the instrument to change over crude into question and protest into primitive. In Java, you can utilize Integer, Float and so forth rather than int, float and so on. We can speak with objects without calling their strategies.
String s1 = “ABC” + “A” ;

Use of wrapper classes in Java also doesn’t make the language as pure OOP, as we use Autoboxing and unboxing operators internally.

public class BoxingExample
{
    public static void main(String[] args)
       {
            Integer i = new Integer(10);
            Integer j = new Integer(20);
            Integer k = new Integer(i.intValue() + j.intValue());
            System.out.println("Output: "+ k);
      }
 }
This was all about Is Java An Object-Oriented Language. Hope you like our explanation of Why Java is not a purely Object-Oriented Language.

4. Conclusion

Hence, in this tutorial for Java we studied why Is Java An Object-Oriented Language, what are the reasons for Java is not a purely object oriented language. Furthermore, if you have any query feel free to ask in a comment section.

Related Topic- Top Java Books

For reference

Leave a Reply

Your email address will not be published. Required fields are marked *