• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

extending given interface

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 147
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic