• 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

q from TestCafe.com

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Select the true statements.

Transient methods cannot be overridden.
a final class may nt be subclassed.
a private method can never be overridden to become public.
an abstract class may contain final methods.
a private method cannot be overridden and made public.
final methods can not be overridden.

I feel only the first option is false. The exam says the 3rd option is also false. Plz explain if the third option is false.
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see the difference between these two choices:

a private method can never be overridden to become public.
a private method cannot be overridden and made public.

In both cases, since private methods can't be inherited by a subclass and are not visible from within a subclass, private methods can't be overridden in a subclass.

A method in a subclass with the same signature (name and parameters) as a private method in a superclass defines a new method altogether. The subclass method can only be invoked on a subclass reference, including this within the subclass, while the private superclass method can only be invoked from within the superclass.

I don't think super within the subclass can be used to call a private superclass method because that method is not visible from inside the subclass, but I haven't tried this.
[ December 24, 2004: Message edited by: Mike Gershman ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where on testcafe.com is this mock exam? Or is this not the testcafe site you mean?
[ December 26, 2004: Message edited by: Barry Gaunt ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic