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
How to make a write-only class in java?
What is string example?
Describe the term diamond problem.
In the below example, what will be the output?
What is unicode with example?
I want to persist data of objects for later use. What’s the best approach to do so?
What is the transient keyword?
How do you execute a thread in java?
Define "Access specifiers" in java.
is there a separate stack for each thread in java? : Java thread
What is float in java?
What is java lang object?
How do you allocate memory to object?
Write java program to reverse string without using api?
Can we extend singleton class in java?