Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is Static ?

 
Dhaval Gandhi
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,,
If we define any class with static keyword then what does it mean ?
Dhawal.
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A class can be defined as static only if it's an inner class. i.e. It's defined inside another class. A static nested class can refer to static methods and variables directly.
Bosun
 
Dhaval Gandhi
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IF WE DEFINE A CLASS WITHOUT STATIC WORD INSIDE ANOTHER CLASS THEN IT WILL MAKE IN DIFFERENCE. ?
DHAWAL.
Originally posted by Bosun Bello:
A class can be defined as static only if it's an inner class. i.e. It's defined inside another class. A static nested class can refer to static methods and variables directly.
Bosun

 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A BIG difference. You need to read "Getting in touch with your Inner Class" in the Campfire Stories area of this site. Not only does it explain inner classes well (both static and not static) but it is fun to read!!!
http://javaranch.com/campfire/StoryInner.jsp
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic