What is the difference between constructor and method?
Answer Posted / sameer inamdar
Constructor must have the same as the class name,
whereas we can give any name to the method.
Constructor doesnt have any return type not even void,
whereas method must have valid return type or void if
nothing is return.
Constructor will implicitely invoke at the time of
object creation, whereas method must invoke explicitely
with the object.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Why map is used in java?
What is the use of volatile in java?
What is * argv?
What are the differences between heap and stack memory?
Explain the difference between abstract class and interface in java?
Is arraylist dynamic in java?
How to change value in arraylist java?
What is array sorting in java?
Will the jvm load the package twice at runtime?
How many ways can you break a singleton class in java?
How is string stored in java?
List the interfaces which extends collection interface?
What is a final class in java?
How are multiple inheritances done in Java?
Can I learn java in 3 months?