Can you explain why a constructor doesn't have return type? - Java

Can you explain why a constructor doesn't have return type?

The primary goal of a constructor is to create an object. Though the constructor resembles a method, its explicit purpose is to initialize the instance variables. Assignment operation resembles like a method, it is to be done just before an object is created. It is certain that the constructor can create the object of that class only. This agreement is unambiguous and crystal clear. Hence a constructor does not have return type.
Explain how to add a button in applet - Java
The following are the steps to add a button in applet: 1. Declare and create the object of Button class - Button clickMe;....
Explain the purpose of jar file - Java
A Jar file contains mostly .class files and optionally other files like sound files, image files for Java applications, gathered into a single file in the compressed format.....
Difference between String s="hello"; and String s=new String("hello"); in Java
The statement String s = “hello” is initialized to s and creates a single interned object....
Post your comment