Is Java a pure object-oriented programming language?
Object oriented programming (OOP) language uses an object-oriented programming technique that binds related data and functions into an object and encourages reuse of these objects within the same and other programs. Many languages are Object Oriented and there are seven qualities to be satisfied for a programming language to be pure Object Oriented. They are:
- Encapsulation/Data Hiding
- All predefined types are objects
- All operations are performed by sending messages to objects
- All user defined types are objects.
Java is pure object oriented or not?
There are lot of arguments around whether Java is purely object oriented or not. Java is not a pure OOP language due to two reasons:
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, double which are not objects. These primitive data types can be used without the use of any object. (Eg. int x=10; System.out.print(x.toString());)
The second reason related to the static keyword . In pure object oriented language ,we should access everything by message passing (through objects). But java contains static variables and methods which can be accessed directly without using objects. That means, when we declare a class as 'static' then it can be referenced without the use of an object.