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 / vishwanath

mainly there are
i.constructor name is same as the class name whereas method name doesn't.
ii.constructor is implicitly called when an object is created.....but the method is explicitly called by using object.
iii.constructor has no return type hence it doesn't return anything.....but method has return type.
iv.constructor is used to create and initialize data members.....where as method is created to code the specific task.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When is the finally clause of a try-catch-finally statement executed?

1074


How strings are created in java?

1041


What is method overloading in java ?

1091


How many bits is a string?

1005


What is a nested list?

966


Can a constructor be made final?

1112


Is 0 true or false in java?

988


If system.exit (0); is written at the end of the try block, will the finally block still execute?

1111


How do I enable java in safari?

1037


Why is singleton instance static?

997


How is string immutable in java?

1038


how is final different from finally and finalize in java?

1058


What is the purpose of the runtime class in java programming?

1061


Can we assign the reference to this variable?

977


Why do we need hashmap in java?

1117