Differentiate constructor and a method and how are it be
used?
Answer Posted / kabita
constructor & methods are both member functions of a class.
when an object is created the constructor is invoked
automatically,bt we have to call the methods explicitly
through objectname.
methods have returntype ,bt constructors haven't.
constructors must have same name as class name bt methods
have not.
constructors are used for initialization of
objects,variables.
| Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
Why there are some null interface in JAVA? What does it mean? Give some null interface in JAVA?
What is the set interface in java programming?
What is an abstract method in java programming?
What does int argc char * argv [] mean?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters in java programming?
What modifiers may be used with an inner class that is a member of an outer class in java programming?
What do the thread?class methods run() and start() do?
List types of storage classes in java?
Can we nested try statements in java?
enlist some features of jdk.
Explain about exception propagation?
List the different types of classloaders in java.
What is the difference between a static and a non-static inner class in java programming?
What is better- service oriented or batch oriented solutions?
What is the original name of java?