This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Top Level Classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Top Level Classes" Watch "Top Level Classes" New topic

Top Level Classes

Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
Simple question. What access modifiers can the top level class have. My book says only public, but my compiler allows friendly as well. And does a top level class simply mean that it isn't an inner class?
By failing to prepare, you are preparing to fail.
Benjamin Franklin (1706 - 1790)

By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You are correct. A Top-Level class usually means a non-inner class. The access modifiers (If any) can only be public. The modifier can be left of, in which case it's consideres package or friendly access.


So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: Top Level Classes
Similar Threads
Traps to be aware of in any SCJP test !!!!! :)
Why private isnt private, story about Inner Class.
Marcus Green #2 Question 8
static inner classes
Roundup game