top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Is Java is a purely Object Oriented programming language, if Not then write a program without class & objects?

+1 vote
352 views

Java is a purely Object Oriented programming language or not.......?
If Not
Then write a program without class & objects.......

posted Jun 8, 2016 by Pankaj Sahni

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

No Java is not a Pure Object Oriented Language. For any language to be pure object oriented it must follow these 6 points strictly
1. It must have full support for Encapsulation and Abstraction
2. It must support Inheritance
3. It must support Polymorphism
4. All predefined types must be Objects
5. All user defined types must be Objects
6. Lastly, all operations performed on objects must be only through methods exposed at the objects.

Java supports 1, 2, 3 & 5 but fails to support 4 & 6.

Now coming to second part of your query -

We need at least one class to have a complete program, because in Java, all code is inside classe. However, code doesn't necessarily need to be in a method. It can also be in initializers. See the following code -

class LookMaNoMethods {
    static {
        System.out.println("Hello, world!");
        System.exit(0);
    }
}
answer Jun 10, 2016 by Salil Agrawal
...