Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URGENT - Empty method and abstract method.

 
Anu
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between abstract methos and a method without any body i.e. only empty braces are given for methos but no body is there.
Why cant we use empty method in the place of abstract method ?
Pls explain the usage/advantages/disadvantages of both....Its urgent !!!
 
sandy gupta
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you do not have to provide the definition of a base class method but an abstract base class method needs to have a definition in the derived class
Got it
 
Sunny Liu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can not call a abstract method, but you can call empty method. class with a abstract method, then it have to be a abstract class, sequencely you can instantiate a abstract class as well.
Usually you provide empty method just because you want to use some other methods from parent class or implements a interface but you do not want to implements all of methods defined in interface definition.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic