File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "constructor" Watch "constructor" New topic


charishma gottumukkula

Joined: Nov 06, 2006
Posts: 20
Can we have parameterized constructor in java ?
Eric Daly
Ranch Hand

Joined: Jul 11, 2006
Posts: 143
read up on sun's java tutorial
you could start on this page and follow the "trail" to learn more about constructors with different parameter lists

Studying for SCJP 6
Henry Wong

Joined: Sep 28, 2004
Posts: 20376

Originally posted by charishma gottumukkula:
Can we have parameterized constructor in java ?

If you mean parameters to the constructor, then as Eric pointed out, the answer is obviously yes.

However, when you say "parameterized", do you mean parameterized types? Like so...

The answer is yes. Java supports generics with constructors -- just like the support for generic methods.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
subject: constructor
It's not a secret anymore!