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 final class modifier?
What’s a deadlock?
Why stringbuilder is not thread safe in java?
What is the use of callablestatement?
Mention some interfaces implemented by linked list in java.
Explain the difference between abstraction and encapsulation.
What are the Main functions of Java?
How does the java compiler work?
What do you mean by collectors in java 8?
Explain java thread life cycle.
What is immutable data?
What does opcode mean?
What is a numeric digit?
What is autoboxing in java?
Explain all java features with real time examples