wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes abstract method overriding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "abstract method overriding" Watch "abstract method overriding" New topic
Author

abstract method overriding

Shiva Mohan
Ranch Hand

Joined: Jan 05, 2006
Posts: 477
Which of the following statements is true?

a. An abstract method can not be overridden by an abstract method.
b. An instance method that is not abstract can not be overridden by an abstract method.
c. An abstract method declaration can not include a throws clause.
d. The body of an abstract method is represented by a set of empty brackets.
e. None of the above.
answer:e

I am trying to understand each one of the concept from a.So "An abstract method can be overridden by an abstract method. "----true.but when I write this on coding way,please help me with that.




Please help me understanding abstract method overriding. And if possible, please help me with b,c,d options too.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
What is the purpose of the following code taken from your example?
Does it compile? If not, what do the errors tell you?



What kind of method is xxx? abstract? concrete?
What is the purpose of the abstract void yyy()? Why is it in a method?
[ July 28, 2006: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Shiva Mohan
Ranch Hand

Joined: Jan 05, 2006
Posts: 477
Thanks for the reply.I am confused about the option a
�An abstract method can not be overridden by an abstract method.�Please forget about the coding I wrote.That exactly gave compile error.Calling abstract method in a abstract method not making any sense.Please explain

�An abstract method can not be overridden by an abstract method.�
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
Atul Sawant
Ranch Hand

Joined: Jul 06, 2006
Posts: 304
Can someone please explain how can instance method which is not abstract CAN be overridden by abstart method with same signature whereas abstract methods CANNOT be overridden by another abstract method with same signature when abstract are meant to be overridden!?

Thanks in Anticipation.


Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
Pawanpreet Singh
Ranch Hand

Joined: Jun 12, 2005
Posts: 264

abstract class A {
void method(){}
}
public abstract class B1 extends A
{
abstract void method();
}


AND

abstract class A {
abstract void method();
}
public abstract class B1 extends A
{
abstract void method();
}

compiled without any error.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: abstract method overriding