• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Why abstract methods have no body?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the attachement below it says:-

An abstract method has no body!

Why an abstract method has no body & why does it ends with a semicolon?

while a abstract class has an body and we use keyword extends ?
abstract_methods_no_body.JPG
[Thumbnail for abstract_methods_no_body.JPG]
 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to implement the body in a child class some where down the line if inheritance. Why world you include a body of you knew that 100% of the time the code would be overwritten?
 
Bartender
Posts: 582
14
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That picture is so weird
 
Bartender
Posts: 1249
87
Hibernate jQuery Spring MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Al Hobbs wrote:That picture is so weird

but It makes easier to keep in mind that abstract methods don't have body.
 
Al Hobbs
Bartender
Posts: 582
14
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ganesh Patekar wrote:but It makes easier to keep in mind


I personally don't like things like that.  It could potentially confuse you if you read too much into that analogy.  
 
Rancher
Posts: 186
7
Mac OS X IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Al Hobbs wrote:

Ganesh Patekar wrote:but It makes easier to keep in mind


I personally don't like things like that.  It could potentially confuse you if you read too much into that analogy.  



I don't like those Head First books, at first I was "wow, great - those pictures will help me to understand the topic" but after first chapter I had enough of them, as you said - they are confusing and distracting.
 
Marshal
Posts: 75716
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do like the books, even though they are rather weighted towards cert exams, and now pretty old. But it is obvious that some styles, particularly one as striking as the Head First style, will be very unhelpful to some people.
 
Screaming fools! It's nothing more than a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic