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 purpose of final keyword and when to use it?

1004


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

1060


What is difference between jdk,jre and jvm?

1125


What is native code?

1120


What is difference between an object and a class?

1126


What are the different types of sorting in java?

980


which class is the wait() method defined in? : Java thread

943


What is the function of compareto in java?

1054


What is the difference between length and size in java?

989


What do you understand by the term string pool?

1011


What is the purpose of object oriented programming?

979


Can vector have duplicates in java?

951


What is difference overloading and overriding?

1170


What is compareto?

1040


How do you check if an arraylist is not empty?

1120