What modifiers may be used with a top-level class

A top-level class may be public, abstract, or final.

Showing Answers 1 - 8 of 8 Answers

Param

  • Jul 6th, 2005
 

The following modifiers may be used with a top-level class: private, protected or public access modifiers and/or either abstract or final (not both).

  Was this answer useful?  Yes

Eclipse

  • Jul 26th, 2005
 

Please correct me if i am wrong..... 
Top level class is the one which will be inherited by other classes down the hierarchy. 
Now if we declare the Top level class as Final then how it will be inherited be other classes, Since final classes cannot be inherited.

  Was this answer useful?  Yes

mrkab

  • Nov 15th, 2007
 

The modifiers a top-level class can have are public and either abstract or final.

A nested class is any class whose declaration occurs within the body of another class or interface. A top level class is a class that is not a nested class.  In other words, a top level class is any class that is not declared within another class or interface.

The modifiers private and protected can only be used with member classes, a top level class is not a member class, it can never be a member class, because if it were a member class it would by definition be a nested class and by definition would not be a top level class.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions