This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

but what useful of them at real time ?  RSS feed

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please can any one tell me when I need use abstract class and interface I know what different but what useful of them at real time when I have project
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Java does not support multiple inheritance, when you need to have a class (or abstract class) that contains various features, you have to use interfaces.

Nick
 
moneer mohammed
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok but agian i need to impelement all the methods so no usefull
please give me example
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi,
Nicolas is right,When u have to use an abstract
class the methods in abstract class have to be
marked abstract,and when this class is subclassed,
subclass need to provide the relevant implementation for
each abstract method,while interfaces methods in Interfaces
are abstract by virtue of their declaration,and
should not be declared abstract.Also an Interface
is abstract by definition and therefore cannot
be instayiated.it should not be declared abstract.

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Nicholas Cheung:
As Java does not support multiple inheritance, when you need to have a class (or abstract class) that contains various features, you have to use interfaces.

Nick




Wow nick what a long list of degrees ?..a studious guy i shud say
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!