java - A bit about the use of Interface -


here final doubt on interface want discussed here, heared rumour interface.i know powerful use of interface:-

like:

  • it used achieve abstraction.
  • by interface, can support functionality of multiple inheritance.
  • it can used achieve loose coupling.

some other point know:

  • interfaces can’t have constructors because can’t instantiate them , interfaces can’t have method body.

  • by default attribute of interface public, static , final, don’t need provide access modifiers attributes if do, compiler doesn’t complain either.

  • by default interface methods implicitly abstract , public, makes total sense because method don’t have body , subclasses can provide method implementation.

  • implements keyword used classes implement interface.

rumour:

  • use of interface make application slower.

is rumour true, hey friends not sure. here intention ask question know opinion of experts. please give words, thanks.

consider tv remote analogy. tv remote interface television.

its standard way of using television(any television...flat screen, crt, led, lcd, plasma etc).

now, tv remotes must have basic common buttons (on, off, vol+, vol-, ch+, ch-), these methods should present in interface. different brands implement these using different techs.(different classes can implement interface in different ways)

now brands want share standard way of controlling television (which big complicated machine). in end, helps consumer/user. far user concerned, he/she not need know how manually operate television or inside or how circuit board works.

one more example: to drive car don't need understand how car's engine works, aa long has standard interface: clutch, gear, brakes accelerator.

our brain manages understand complex systems using abstractions. interface way of representing abstraction.

hope helps in way.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -