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

Can extern variables be initialized?

952


What is a list in java?

946


Explain importance of finally block in java?

1037


Explain the importance of finally block in java?

967


How to check if linked list contains loop in java?

903


What is the purpose of file class?

1025


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

992


What is listnode in java?

989


What are dot operator queries?

1103


What is "this" keyword in java? Explain

1098


What is logical variable?

978


In multi-threading how can we ensure that a resource isn't used by multiple threads simultaneously?

1321


Can we declare the main method of our class as private?

1001


Why vector is used in java?

1025


What is passing value java?

1058