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 do you mean by local class?
Can we create object of static class?
Explain the concept of proper inheritance?
What do you mean by flow of struts?
What is the function of http?
How you can force the garbage collection?
Why pass by reference is not possible in java?
How to perform quicksort in java?
What do you mean by object?
What is double checked locking in singleton?
What is return data type?
What do you mean by mnemonics?
How can you add and remove nodes in jtree?
Will the compiler creates a default constructor if I have a parameterized constructor in the class?
Why object class is super class for every class in java?