aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes define new methods in DBMain Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "define new methods in DBMain" Watch "define new methods in DBMain" New topic
Author

define new methods in DBMain

Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 775
May I add getRecords() to DBMain to load all database records?
Instruction.htlm doesn't say I can't.
Any recommends?
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

As far as I know you are not allowed to change the given interface. But you can of course create your own interface which extends the DBMain interface and define a few new methods. That's just fine. I would definitely not change the given interface.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2266
    
    3

Roel De Nijs wrote:I would definitely not change the given interface.


Me neither. And welcome to JavaRanch!


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 775
Thanks,guys.

interface MyDBMain extends DBMain { //declare new method signatures....}
class Data extends MyDBMain { //implements MyDBMain, DBMain methods.....}

Sounds valid?

Roberto buddy wrote an example like that in his paper.Just make sure as English is my second langugage. Thanks for your patience.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5408
    
  13

Himai Minh wrote:

interface MyDBMain extends DBMain { //declare new method signatures....}
class Data extends MyDBMain { //implements MyDBMain, DBMain methods.....}

Sounds valid?


That's a valid approach, but will not compile (classes don't extend interfaces)
Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 775

Correction:
class Data implements MyDBMain {...}
Thanks.
 
 
subject: define new methods in DBMain