• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic