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

why constructor dont have returns type?

Answer Posted / vishwanath

because it is called implicitly when object is created... so it doesn't have any target to return values....
for ex..
int v=Integer.parseInt(X.readLine());
int n=fact(v);
int fact(int)
{
.....return ans
}
so it return ans to the variable n which is assigned to calling statement..... when compared the constructor don't have any target to return

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is binary a low level language?

918


What are the advantages of exception handling?

1064


How does multithreading take place on a computer with a single cpu?

1005


Can you write a java class that could be used both as an applet as well as an application?

962


What is lambda in java?

1074


When should the method invokelater() be used?

1019


Is object a data type in java?

1113


Which one will take more memory: an int or integer?

1233


Can I import same package/class twice?

952


Can list be final in java?

929


what state does a thread enter when it terminates its processing? : Java thread

1049


why are wait(), notify() and notifyall() methods defined in the object class? : Java thread

984


What things should be kept in mind while creating your own exceptions in java?

1160


What is the program development process?

973


Why is multithreading important?

945