wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "constructor" Watch "constructor" New topic
Author

constructor

charishma gottumukkula
Greenhorn

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

Joined: Jul 11, 2006
Posts: 143
absolutely
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
http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html


Studying for SCJP 6
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18491
    
  40

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.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: constructor
 
Similar Threads
main method
WA #1.....word association
Constructor doubt - K&B Book
Can I overload a constructor with enum values?
IS CONCTRUCTOR IS A METHOD