aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes a question about Dan's mock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "a question about Dan Watch "a question about Dan New topic
Author

a question about Dan's mock

feng lee
Ranch Hand

Joined: Oct 29, 2002
Posts: 33
abstract class A { // 1
private abstract void m1(); // 2
private abstract class B {} // 3
private class C extends B {} // 4
}

Compiler errors are generated at which of the following lines?
a. 1
b. 2
c. 3
d. 4
e. None of the Above.
the answer is b .but i think is c,d.help!
Abu Yoosuf
Ranch Hand

Joined: Nov 14, 2002
Posts: 33
abstract class A { // 1
private abstract void m1(); // 2
private abstract class B {} // 3
private class C extends B {} // 4
}
line //2 (generates compile error):
private and abstract are mutually exclusive modifiers for methods. The private modifier indicates nobody outside of me should see it. The abstract modifier for methods indicates, someone down the line in my class hierarchy should provide the implementation.
line //3 (legal):
class A wants to have an abstract template, which it can use to define some classes. Class A decides that outside the scope of class A, the template (i.e., abstract class B) hasn't got a meaning. So, class A keeps it encapsulated within its boundary.
line //4 (legal):
You can define a private class within a class. It is perfectly legal for class C to extend from private class B as the scope of B is the entire body of class A.
[ December 08, 2002: Message edited by: Abu Yoosuf ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: a question about Dan's mock