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 are 3 data types?
what is the difference between the methods sleep() and wait()? : Java thread
What is variable and rules of variable?
What is valid keyword in java?
Can java cast null?
Why stringbuilder is not thread safe in java?
Why is singleton class used?
What is the association?
Can I overload to string method
Does chrome use java?
Is minecraft java edition free?
Where are global variables stored?
How will you initialize an Applet?
How many static init can you have?
What is the difference between serial and throughput garbage collector?