Show Mobile Navigation

Webring

Powered by WebRing.
,

Java is 100% object oriented or not?

Sachin R Kukale - 01:02
In many interviews interviewer will ask you a question about java is 100% object oriented or not. The answer to this question is quiet difficult for the beginner to intermediate programmers also.Actually there are lot of views regarding the object orientation in Java and whether it is 100% oriented or not? In this article we will discuss about object orientation about the java.
So first lets list out the what are the different object oriented concepts in java:
  1. Class
  2. Object
  3. Inheritance
  4. Polymorphism
  5. Abstraction
  6. Encapsulation
So in Java all the above concepts can be implemented either completely or partially. As far as I know there is no authorized document to decide whether a particular programming language is 100% object oriented or not? But there are some rules that can be use to define whether the particular programming language is object oriented or not? For instance see the following rules:
  1. The language should be capable of implementing encapsulation feature.
  2. The language should be capable of implementing the inheritance feature.
  3. It should able to provide the feature of polymorphism.
  4. All types defined by users should be object. That means we can not define data types using primitive data types such as int, float, long etc.
  5. You must perform the operations by exchanging the messages between objects.
  6. The predefined types in language must be object.
If you consider above rules then you will find out that Java is not a 100% object oriented language. The Java supports inheritance. But Java does not support multiple inheritance in case of classes using "extends" keyword. At the same time Java provides the feature of multiple inheritance in case of interfaces by using the "implements" keyword. So this is confusing.
Again in Java you have the option to declare the data types using Wrapper classes which means you can declare data types as object in Java. But thing is that for any language to be pure object oriented everything should be object. And in Java there are lot of things which are not pure objects.
So in my opinion Java is not pure object oriented language; though it implements most of the features of object oriented language. The few reasons why java is not pure or 100% object oriented language are:
  1. Though you have option to declare primitive data types as objects using Wrapper classes in java; you can declare them as primitive data types in java.
  2. Java does not support the feature of multiple inheritance using extends keyword.
  3. Sometimes you can perform some operations without using objects or without passing any message to object using "static methods"in java.
So as per my opinion Java is not 100% object oriented language or we can not call it as pure object oriented language.
Object orientation is the way only to develop some applications using a programming language which is easy to code, easy to read and easy to understand. This easiness provided by splitting the problems in terms of objects and methods. Definitely Java has all the object oriented features but it lags when we talk about purr object orientation. So now you can say that Java is not pure object oriented language or java is not 100% object oriented.

0 comments:

Post a Comment