Originally posted by Trevor Green:
Consider the following class definition:
public class Parent {
final void zzz() { }
}
Which of the following methods may appear in a subclass of Parent, when the subclass is in a different package from Parent? Choose all correct options
Supposed wrong answer:
A) void zzz() { }
My argument:
Given the child class is in a different package, it can't see the void zzz() method and so it can create all sorts of void zzz() doing whatever they like because it's not really overriding or overloading.
This not the case?
Originally posted by Trevor Green:
Consider the following class definition:
public class Parent {
final void zzz() { }
}
Which of the following methods may appear in a subclass of Parent, when the subclass is in a different package from Parent? Choose all correct options
Supposed wrong answer:
A) void zzz() { }
My argument:
Given the child class is in a different package, it can't see the void zzz() method and so it can create all sorts of void zzz() doing whatever they like because it's not really overriding or overloading.
This not the case?
My theory of evolution is that Darwin was adopted. - Steven Wright
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Note: Method void zzz() in class Child does not override the corresponding method in class Package1.Parent. If you are trying to override this method, you cannot do so because it is private to a different package.
1 warning
"JavaRanch, where the deer and the Certified play" - David O'Meara
"JavaRanch, where the deer and the Certified play" - David O'Meara
"JavaRanch, where the deer and the Certified play" - David O'Meara
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Trevor Green:
Consider the following class definition:
public class Parent {
final void zzz() { }
}
Which of the following methods may appear in a subclass of Parent, when the subclass is in a different package from Parent? Choose all correct options
Supposed wrong answer:
A) void zzz() { }
My argument:
Given the child class is in a different package, it can't see the void zzz() method and so it can create all sorts of void zzz() doing whatever they like because it's not really overriding or overloading.
This not the case?
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Have you tried this Mock Exam Testing Engine yet?<br /><a href="http://www.mycgiserver.com/~nan111/index.html" target="_blank" rel="nofollow">www.mycgiserver.com/~nan111/index.html</a>