Java - Constructors vs. regular methods

Constructors vs Regular Methods.

ConstructorsRegular Methods
Constructor is called implicitly.Method is called explicitly.
Constructor can have same name of the class name.Methods can have any arbitrary name in Java.
It doesn't have any return type.It has return type.
Constructors are called in a particular order.There is no such facility for methods like constructors.
'this' and 'super' keyword is used to call constructor explicitly.Methods have there own name that can be used to call.
Constructors are called only once.Regular methods can be called as many times as required.
What is package in JAVA?
What is package in JAVA? - Java packages help in organizing multiple modules. It helps in resolving naming conflicts when different.
Java - == vs. method equals()
== vs. method equals() - The method equals() is used to compare the values of the Strings.....
What are Native methods?
What are Native methods? - Native methods are the methods implemented in other language like C. These methods can be used in Java...
Post your comment