• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

abstract method overriding

 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Atul Sawant
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic