wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes bout top-level class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "bout top-level class" Watch "bout top-level class" New topic
Author

bout top-level class

jay vyas
Greenhorn

Joined: Dec 12, 2000
Posts: 9
hi friends,
Declaration of Top-level class Frog are legal, assuming animal is a existing class
A. protected class Frog extends Animal{}
B. private class Frog extends Animal{}
C. transient clas Frog extends Animal{}
D. native class Frog extends Animal{}
as per my knowledge Top-level class must be either public or default. so that way none of above is correct answer but when i try to compile this code with protected and private modifier their class file created. so what should be the answer ?
thanx in advance
jay...
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

I get a compile time exception "Syntax Error" when i try to make top level class protected or private.


SCJP
Visit my download page
jay vyas
Greenhorn

Joined: Dec 12, 2000
Posts: 9
Originally posted by Randall Twede:
I get a compile time exception "Syntax Error" when i try to make top level class protected or private.

thanx Randall,
but if u have noticed then there will be class file created for protected and private modifier
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

yes i have heard of this before. it creates the class file even when the compiler throws an exception.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: bout top-level class