hello friends, as we know constructor is a type of method but not having any return type even not void. i like to know, if we define any variable in construction body, then is this variable will be a local variable or something else.
an student of Operation Badar ( a educational movement in Pakistan).
the constructor has a return type .. only this is not explicitly defined in the code .. the contructor return type is same as its class type. This return type is implicit. The contructor 'constructs' and returns an object of the class in which it is defined. [ January 04, 2002: Message edited by: Karthikraj Magapu ]
This is a fun argument; people love to pick sides. For fun and to annoy purists, I like to go with the 'special type of method crowd.' But the 'not a method' crowd has some strong points to make, to wit: a constructor is a special type of method which has no return type, and can't be overridden regardless of its scope, is that right? And is java.lang.reflect.Constructor then a subclass of java.lang.reflect.Method, hm? Now admit it, guys, there's no such thing as an "implied return type." Even if there was, it most certainly does equate to a class reference. You guys are making that one up. Specially for Cindy: if I happen to load a brick in my refrigrator, does that make it a special type of food? [ January 08, 2002: Message edited by: Michael Ernest ]
Make visible what, without you, might perhaps never have been seen. - Robert Bresson
Joined: Sep 29, 2000
Specially for Cindy: if I happen to load a brick in my refrigrator, does that make it a special type of food?
No - but it might suddenly make it a special type of "refrigerator thingy". So we should call a constructor a special type of "method thingy"??? [ January 08, 2002: Message edited by: Cindy Glass ]
Joined: Jan 07, 2002
Hmm, I think "instance creation doohickey" has a nicer ring to it.