Somerset reasons are put forward by many people to say Java is not a pure object oriented programming language.
1) Primitive data type: Pure OOPs means it should contains only classes and objects but Java contain primitive data types like into, float, char etc, since they are neither classes nor objects.
2) In pure OOPs, we should access every thing through objects but Java contains static variables and methods which can be accessed directly without using objects.
3) Java does not support multiple inheritance. It means an important feature of OOPs is lacking
But
No doubt Java is a purely OOPs language.
1) Even if Java has primitive data types, these types are used inside a class and never outside of it. So, they are part of class.
2) Even static variables and static methods are written inside a class. When accessing them from outside, we should use class name. It means they are part of class and should not considered as individual elements.
3) Any purely OO language should follow all 5 features of OOPs. They are a) class and object b) Encapsulation c) Abstraction d) Inheritance and 5) Polymorphism.
Remember Java contains all these features and hence it is purely object oriented language. Just because Java does not contain multiple inheritance, we should not say it is not purely object oriented language. Multiple inheritance is not the main feature of OOPs, it is only sub feature under inheritance.
No comments:
Post a Comment