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

What is the difference between numeric and integer?

1008


Which non-unicode letter characters may be used as the first character of an identifier?

1007


What is stack class in java?

1035


What is the difference between a synchronized method and a synchronized block?

1069


What is the base class of all classes?

1057


What are the six ways to use this keyword?

1061


What is string builder?

889


Are there structures in java?

962


Why do we use bufferedreader?

999


How do you allocate memory to object?

999


how we can make a write-only class in java?

1023


What if constructor is protected in java?

1115


what is a thread pool in java and why is it used?

1001


What is java and their uses?

1035


Which object oriented concept is achieved by using overloading and overriding?

1105