Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: Adding methods to Data that are not in  DBMain Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: Adding methods to Data that are not in  DBMain" Watch "B&S: Adding methods to Data that are not in  DBMain" New topic
Author

B&S: Adding methods to Data that are not in DBMain

Eric Alex
Greenhorn

Joined: Mar 18, 2008
Posts: 1
Hiya,

My Data class implements all the methods that are specified in the DBMain interface. I've also added some other methods to the class that I feel that I need like:
getNumberOfFields()
getFieldNames()

Question: Is this ok or is the Data class ONLY supposed to contain the methods specified in the DBMain interface?
Mike Ottinger
Ranch Hand

Joined: Jan 11, 2002
Posts: 125
Hi Eric,


SCJP 1.4 SCJD 1.5
Mike Ottinger
Ranch Hand

Joined: Jan 11, 2002
Posts: 125
wooooops!

Hi Eric,

I added 2 additional public and 2 additional private methods to my implementing class. No problems with that at all. I would NOT add these method declarations to the supplied interface, though. Leave that untouched. Hope this helps.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: B&S: Adding methods to Data that are not in DBMain