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


Please Help Members By Posting Answers For Below Questions

What is the statements?

832


Can we sort list in java?

806


How do I type unicode?

742


What is string array?

846


What super () does in java?

688


What's the base class in java from which all classes are derived?

1020


What are the advantages of autoboxing?

764


What is the purpose of the strictfp keyword?

860


What is a local, member and a class variable?

805


What is nested top-level class?

786


Lowest Common ancestor in a Binary Search Tree and Binary Tree.

766


What is r in java?

797


What is the use of singleton?

737


What is command line argument in java?

852


What is the purpose of static methods and variables?

781