Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Why do we create public static method in java?

1043


What is a qms manual?

936


Why scanner is used in java?

1007


Which data type is class in java?

950


Is singleton set an interval?

898


How does compareto work in java?

981


How many times finalize method will be invoked? Who invokes finalize() method in java?

963


Write a program to print count of empty strings in java 8?

934


What are the drawbacks for singleton class?

941


Why runnable interface is used in java?

1053


What is the latest version of java?

1048


What is formatted output?

894


What are 5 boolean operators?

1095


Why does java have two ways to create child threads?

905


What are locale settings?

933