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...

Explain role of constructor in a java application?

Answer Posted / sindhura

A constructor in java has the same name as that of the
class. Whenever the statement such as classname objectname
is encountered, it calls the constructor to initialise the
values for the object. It doesnot return anything and as
soon as the object is created constructor would be called.

ex. : if there is a class called A

A a = new A();
here A a statement would call the constructor immediately
to initialise the values for a object.

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between an object-oriented programming language and object-based programming language?

1055


When is an object subject to garbage collection?

1148


What is a pattern what is an anti pattern?

1030


In how many ways we can do synchronization in java?

1009


What is exception handling in java?

1079


Explain about fail fast iterators in java?

1116


What does it mean that a method or field is “static”?

1022


Is string pool garbage collected?

1068


What do you understand by java virtual machine?

1237


What is meant by class and object in java?

1107


What is parsing a string?

1236


Which is the best approach for creating thread ?

1269


How do we access static members in java?

1157


What is the map interface in java programming?

1053


What best practices should you follow while writing multithreaded code in java?

1108