• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

abstract method overriding

 
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.�
 
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 264
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic