This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Abstract methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Abstract methods" Watch "Abstract methods" New topic
Author

Abstract methods

damodar kumar
Ranch Hand

Joined: May 19, 2008
Posts: 77

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.


<a href="http://stackoverflow.com/users/668970/user668970" rel="nofollow">
<img src="http://stackoverflow.com/users/flair/668970.png" >
</a>
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

1) You must implement all the abstract methods if you want a concrete subclass.

2) Yes, the abstract keyword is required in that case.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
damodar kumar
Ranch Hand

Joined: May 19, 2008
Posts: 77

For above question 1 if subclass is also abstact , then it is necessary to implement all abstarct methods
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
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

Joined: May 12, 2008
Posts: 55
this is my first answer !! and no a question

hope it helps


[ June 02, 2008: Message edited by: podonga poron ]
 
 
subject: Abstract methods
 
Similar Threads
Getting super class of 2 subclasses
Using the Keyword super
constructor question
abstract methods
OverRiding???