my dog learned polymorphism*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Data.class constructor requirements 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 » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Data.class constructor requirements" Watch "Data.class constructor requirements" New topic
Author

Data.class constructor requirements

Layne Wakerell
Greenhorn

Joined: Jul 05, 2007
Posts: 1
The Data.class needs to implement the DB interface. Does this mean the Data.class can have any constructor you like? e.g.

DB database = new Data("filename.db");

or

DB database = new Data(new File("filename.db"));

or even

DB database = new Data();//where the database file is hardcoded in the Data.class

How will the automated test tool create an instance of our Data.class???
Gennadi Oreper
Greenhorn

Joined: Mar 09, 2006
Posts: 9
Hello!

I have two constructors coded:

Data():
call anyInitDb(dataSource) with dataSource as String from property file || hard coded, also default db file
AND
Constructor with the path to the data file Data(String dataSource) call the same anyInitDb(dataSource)...

Best regards...


_ ____________________ _ <br />SCJP - 1.4<br />SCJD (B&S) - In Progress<br />_ ____________________ _
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Originally posted by Layne Wakerell:
The Data.class needs to implement the DB interface. Does this mean the Data.class can have any constructor you like? e.g.

DB database = new Data("filename.db");

or

DB database = new Data(new File("filename.db"));

or even

DB database = new Data();//where the database file is hardcoded in the Data.class

How will the automated test tool create an instance of our Data.class???


You can have as many or as few constructors as you like. And they can be in format you like too, which is nice.
[ July 07, 2007: Message edited by: Mark Smyth ]

SCJP<br />SCJD
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi Layne,

Don't worry abut the test automate. The test automate will get (build) a Data instance and in a way or other.

Regards,
M


SCJP, SCJD, SCWCD, OCPJBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data.class constructor requirements
 
Similar Threads
Server Design Issue
NX: stand-alone mode using RMI
Collaboration
NX:should lock the database during the creating?
Some wrong with "java -jar"