• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

What is Static ?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,,
If we define any class with static keyword then what does it mean ?
Dhawal.
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic