Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static class

 
Prashanth Naidu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,
I dont understand why you declare a static class in java? I know static means that there is only one copy and every object does not have its own copy of a static method / field. so isn't static mainly used for fields or methods? Why use static for a class. e.g,: public static class myclass {}
-P
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is used for inner classes only. It simply means that the inner class can be used without instantiating the outer class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic