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
In a container there are 5 components. I want to display all the component names, how will you do that?
Does java support function overloading, pointers, structures, unions or linked lists?
What do you mean by byte code?
How can we create a synchronized collection from given collection?
Is java an open source?
Is the empty set a singleton?
what is meant by HQL?
What best practices should you follow while writing multithreaded code in java?
Is int a class in java?
Can we override constructors?
How thread scheduler schedule the task?
What is the difference between the direct buffer and non-direct buffer in java?
What is java instanceof operator?
What is the abstraction?
Can we define package statement after import statement in java?