A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Why Java is not a Pure Object-Oriented Language

Why Java is not a Pure Object-Oriented Language

What does it mean by object-oriented language?

  • Object-oriented language (OOL) is a high-level computer programming language LIKE java, C# and python. There are many non-OOP languages like Assembler, C, Fortran, COBOL, Forth and Pascal.
  • OOL implements objects and their associated procedures within the programming context to create software programs and automate the business or calculation.
  • It gives Object-oriented programming (OOP) that classifies software project about data, or objects, rather than functions and logic.
  • Where, an object can be defined as a data field that has unique attributes and behaviour.
  • Java is not Pure Object-Oriented Language or Complete Object-Oriented Language.
  • Java is Fully Object-Oriented Language which supports all features which pleasures all inside program as objects.
  • Java doesn't support primitive datatype. Where primitive datatype are int, char, float, bool, etc.

Why Java is not a Pure Object-Oriented Language?

There are primarily three reasons that causing to be pure:

  1. Java doesn't support primitive datatype.
  2. Due to the static keyword and
  3. Wrapper class.
Due Primitive datatype: -
While writing simple arithmetic calculation, we use int data type, and in java we have Predefined types as primitive data types which is non-objects.
int x = 10;
System.out.print(x);
Due to the static keyword: -
While writing a program in java, if we define a class as static then we do not require to access. We can directly access class. If we declare a function or variable as static, then there is no requirement of the object we can call through the object. We must give class name dot resource name.
Due to Wrapper class:-
Wrapper class in java is used to convert primitive into object and object into primitive. You can use Integer, Float, Double etc instead on int, float, double etc. In java, we can communicate with objects without calling their function which is also known as auto-boxing in java feature. In simple-example: -
String fullName = "Heera" + "Babu";

Wrapper classes internally use actions like Unboxing and Autoboxing and it does not make Java a pure OOP language. You should know that Java, C++ and Smalltalk are very popular object-oriented languages. Very few pure OO languages are Smalltalk and Eiffel. However, Java is one of the greatest effective and most successful Object-oriented programming languages. Recently in Java 8, there are many new features came and continuously next generation java is going on, Java got some functional programming touch in Java 8 and it is never considered 100% or pure object-oriented programming language.

What are those criteria from which a programming language can be pure object-oriented?

There are minimal criteria of a computer programming language to be purely Object-oriented language: -
  1. Encapsulation or Data Hiding
  2. Inheritance
  3. Polymorphism (method overloading and method overriding)
  4. Abstraction (Abstract class and Interface)
  5. All predefined types should be objects
  6. All user defined types should be objects.
  7. All operations performed on objects must be only through methods showing at the objects.












LEARN TUTORIALS

.

.