• Post Reply Bookmark Topic Watch Topic
  • New Topic

class as static  RSS feed

 
Rahul Ba
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

HI all,

I did not get why we declare class as static? What are the advantages of it.

e.g classes like StringEncoder, StringDecoder in JDK.

Rahul
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can only declare nested classes as static. It is not necessary to have an instance of the enclosing type before to instantiate or gain access to a (static) nested class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!