Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abstract methods

 
damodar kumar
Ranch Hand
Posts: 77
Android Chrome MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) In super class i have 5 abstarct methods. im in need of only 2 methods of superclass , did i want implement all the 5 mentods or i can go for only 2 methods in sub class.

2)super class contains abstarct methods , in subclass also im not implementing superclass methods, in another subclass i will implement those methods , is that complusary to have abstarct keyword for all that subclass.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) You must implement all the abstract methods if you want a concrete subclass.

2) Yes, the abstract keyword is required in that case.
 
damodar kumar
Ranch Hand
Posts: 77
Android Chrome MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For above question 1 if subclass is also abstact , then it is necessary to implement all abstarct methods
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by damodar kumar:
For above question 1 if subclass is also abstact , then it is necessary to implement all abstarct methods


Hi Damodar,

Welcome to JavaRanch.

No,it is not required to implement all the methods of superclass. More about Abstract class and methods.This will surely help you.

And hey Jeanne,

You are having a Nelson's number of posts (11111).
[ June 02, 2008: Message edited by: Vishal Pandya ]
 
podonga poron
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my first answer !! and no a question

hope it helps


[ June 02, 2008: Message edited by: podonga poron ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic