• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

extending given interface

 
pramod karnani
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi All,

I created separate interface to declare extra methods which extends Sun interface.
That sub interface is implemented by Data class so it means Data class also implements Sun interface also , correct?



Regards,
Pramod
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pramod,

Before you work with the Sun interface, you need to decide to use RMI or Sockets. And is "extending" Sun interface a good idea? Ultimately your Data class needs to implement Sun's interface or its sub-interface.

So the answer to your second question is correct. First question you should rethink if that is the way to go. Do think about how client catch exceptions when designing your "service layer".

As for the submission jar file http://faq.javaranch.com/java/ScjdFaq#submissionJarName
 
Yucca Nel
Ranch Hand
Posts: 147
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pramod karnani wrote:
Hi All,

I created separate interface to declare extra methods which extends Sun interface.
That sub interface is implemented by Data class so it means Data class also implements Sun interface also , correct?



Regards,
Pramod


Leave db.java alone! Do research on code to an interface and not implementation. (google it). Sun may perform the following check on your interface.

DB candidatesDB = new Data();

This is why Data MUST extends DB. Whats more is why can the sun interface not extend it's own interface that it need functions for?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi pramod,

According to your description, you did something like this:

This is just a fine approach, nothing wrong with it. I used exactly same approach.

Kind regards,
Roel
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:This is just a fine approach, nothing wrong with it. I used exactly same approach.


Me too!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic