• Post Reply Bookmark Topic Watch Topic
  • New Topic

Abstract Methods  RSS feed

 
Matt Hazan
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Java and I am having a really hard time understanding how to use abstract methods. I don't really understand how they work, why are they important?

Can someone simplify the main idea behind abstract methods and their implementation??

Note that java is really new to me, I tried googling 'abstract methods java' but most of the examples that I came across are above my level of understanding.

Thanks in advance.
 
Mohamed Sanaulla
Bartender
Posts: 3185
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the posts which I got after searching in the forum. As this is a common question, there might be possibilities that it has been asked before.
 
harshada patil
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abstract is a modifier word provided in java and which allows you to declare a method without body..

you might be knowing inheritance in java and in which for example you created a shape class with many base classes such as circle, rectangle etc. and your shape class contain abstract method area,,, then all sub class should define area method compulsory..

some points:
1. you can't create object of a class with abstract method in it eg. shape here
2. if sub class doesn't implements all abstract methods of base class.. then subclass must also be declared as abstract class
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!