This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes class declaration as static Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class declaration as static " Watch "class declaration as static " New topic

class declaration as static

abhay jain
Ranch Hand

Joined: Jun 03, 2011
Posts: 130
we can not declare a class as static class
1. is that correct ? if yes then why is it so ?
2. is there any exceptional case where a class declared as static

for example the following code gives error on compiling

Vijay Tidake
Ranch Hand

Joined: Nov 04, 2008
Posts: 146


you can only declare the inner class as the static class but not the outer class.

Please check this also


The important thing is not to stop questioning.Curiosity has its own reason for existing.
abhay jain
Ranch Hand

Joined: Jun 03, 2011
Posts: 130
Thanks a lot my friend
It is sorta covered in the JavaRanch Style Guide.
subject: class declaration as static
It's not a secret anymore!