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 statements?
Can we sort list in java?
How do I type unicode?
What is string array?
What super () does in java?
What's the base class in java from which all classes are derived?
What are the advantages of autoboxing?
What is the purpose of the strictfp keyword?
What is a local, member and a class variable?
What is nested top-level class?
Lowest Common ancestor in a Binary Search Tree and Binary Tree.
What is r in java?
What is the use of singleton?
What is command line argument in java?
What is the purpose of static methods and variables?