Is the popular saying 'Everything is an object in Java' true?


Although it is based on C++, Java is more of a “pure” object-oriented language. In Java, everything extends into an Object class. It means the coding is mostly wrapped in Java objects. The Java language assumes that you want to do only object-oriented programming.

You cannot code anything in Java without declaring classes and objects.

For example, if you have to say a small sentence "Hello World", it should be declared as a class:

class HelloWorldApp {
   public static void main(String[] args) {
      System.out.println("Hello World!"); // Display the string.
   }
}

Because more than 90% of coding involves objects, It is popularly said that "Everything is an object in Java".

raja
Published on 02-Jan-2019 13:21:56
Advertisements