Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

interface  RSS feed

 
samrat
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Report post to moderator
What is the purpose of using interface in java?
 
Shashi Kant
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi

as you know java does not support multiple inheritance.
so by using interfaces you can implement the multiple inheritance in java by implementing more than one interface in one class.

variable declared in interface are by default Static final constants only, can use them without qualification in classes that implement the interface. On the other paw, these unqualified names pollute the namespace. You can use them and it is not obvious where they are coming from since the qualification is optional.

more on interface --> http://mindprod.com/jgloss/interfacevsabstract.html
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!