Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

default values in constructors?

Status
Not open for further replies.

developerinlondon

Programmer
Jan 11, 2003
196
GB
Does Java have a way of passing default values to constructors?
eg
public MyConstructor(ResultSet rs, String ip, DataSource ds,
String parserURL = null) {
...
}

this is the version that doesnt work in java.
 
There is something in 1.5. Go and have a look on the Sun site.
 
You can alwaus check in the constructor if the values are informed.

Cheers,

Dian
 
The way I do it is provide 2 constructors - the short one calls the long one supplying the defaults
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top