File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes abstract class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "abstract class" Watch "abstract class" New topic
Author

abstract class

Basu Patel
Ranch Hand

Joined: May 28, 2000
Posts: 60
Is this true or false?
All abstract classes have implicitly abstract methods? meanning I cannot have concrete methods in an abstract class?
Marcus Green Exam 3 states it to be true
but Patric Naughton states that concrete methods are allowed in an abstract class, which mean these methods have a method body and cannot be abstract.
Please help me clarify this doubt!
Thanx


<BR>Contact Me<BR> <A HREF="mailto:basu_patel@usa.net" rel="nofollow">basu_patel@usa.net</A> <P>
Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
Yes abstract classes can have non abstract methods i.e methods with the body.
Basu Patel
Ranch Hand

Joined: May 28, 2000
Posts: 60
Please justify how can these non-abstract methods in an abstract
class be implicitly abstract?
Thanx
Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
Hi Basu
They are not implicitly abstract.Only those methods are abstract which u declare them as abstract and only they need to be implemented.
check this
abstract class ab
{
abstract void sun();
void nonabs()
{
System.out.println("nonabs");
}
}
class abs extends ab
{
void sun()
{
System.out.println("in sun");
}
}
The method nonabs is not abstract.
mmkris_1
Greenhorn

Joined: Jun 18, 2000
Posts: 15
hi everyone
I think a class needs to declared abstract if it has one or more abstract methods. The viceversa need not be true i.e. if a class is abstract then it should contain only abstract methods.
Basu Patel
Ranch Hand

Joined: May 28, 2000
Posts: 60
From what I understand , Marcus Green exam 3, has made this mistake of calling all methods in an abstract class as implicitly
abstract.
Thank You guys for time.
Basu
 
 
subject: abstract class
 
Threads others viewed
Abstract class without abstract method
about abstract class
abstract class with concrete methods
Doubt on Abstract classes
Where's Servlet.service() method defined?
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture