Differentiate constructor and a method and how are it be
used?
Answer Posted / pranab dutta
A constructor is a member function of a class that is used
to create objects of that class where as a method is an
ordinary member function of a class.
Constructor has the same name as the class itself and
Member has its own name.
A Constructor has no return type, and is invoked using the
new operator.. Whereas a Member has a return type (which
may be void), and is invoked using the dot operator.
Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
What is the synonym of string?
Why there is no call by reference in java?
Can a class extend 2 classes in java?
Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?
What are the advantages and disadvantages of object cloning?
I am a fresher and know core java, c languge, html, css etc if I am illegible for any job then send it on my email tatranakshay276@gmail.com
why not override thread to make a runnable? : Java thread
What is a null check?
How to use Media tracker Class.
What is an image buffer?
Which is better stringbuffer or stringbuilder?
What is class level lock ?
Difference between collection, collection and collections in java?
What is derived datatype?
How to check if a list is sorted in java?