• 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

Interface and abstract

 
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
for interface:

while implementing interface we need to take care
1)the implemented method shuld be public.since by default the interface are public and final.shall we able to mention it explicitly.
2)can the methods be overloaded or overridden

Absract:

1)similar to that is there any rule that we need to take care while extending the abstract.what is the access modifier for the method in the abstract(by default).
2)can the methods be overloaded or overridden

please share ur knowledge in these topics.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"yes" on all counts.
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi wenting

please share your knowledge on the interface and abstract.
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interface & Abstract

==>Abstract class can define both abstract and non abstratc methods, an ==>interface can have only abstract methods.
==>Interface methods must not be static
==>Interface can declare only constants not instance variables.
==>Interace variables are cannot be either protected or Transient.
==>Interface methods are cannot be static or final
==>Abstract classes are cannot be marked as final
==>Abstract classes are cannot be instantiated
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interface methods must not be static

i didn't get why it so? any explanation
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Interface methods are public and abstract(not final) by default.u can also declare it explicitly.Even the interface can be declared abstract.
2.overriding and overloading is possible.
abstract class
1.The abstract methods should not be declared private.It can have public,protected and default access.
2.The abstract methods can be overridden and overloaded.
Hope this helps....
reply
    Bookmark Topic Watch Topic
  • New Topic