Categories
Core JAVA

Difference between constructor and method

Difference between method and constructor The following are the difference between method and constructor. Method name may or may not be the same as the class name whereas the constructor name must be same as the class name. A method should have a return type in java where are constructor never returns any value, so […]

Categories
Core JAVA

Constructor in JAVA

  CONSTRUCTOR IN JAVA:- The constructor in Java is very similar to the method. The main job of the constructor is to initialize the object. The constructor is a block of code that initializes the newly created object. A constructor is called automatically when a new instance of an object is created. Each and every […]