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
Yes abstract classes can have non abstract methods i.e methods with the body.
Basu Patel
Ranch Hand
Joined: May 28, 2000
Posts: 60
posted
0
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
posted
0
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
posted
0
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
posted
0
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