• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

static variables

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can i use static variables in Abstract classes and how it will be useful to me
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
We can use the staic variables and static methods in the abstract class just like how we use them in normal classes the normal restrictions hold good and they are
1. They can only call other static methods (in case of static methods)
2.The static methods can only access the static data
3. They cannot refer "this" or "super" in any way.
The abstract classes are always extended and the static methods and static variables are used to make the method or variable common to all the objects and they are class but not object dependent.
Cheers,
Gaya3
-------------------------------------------------
Beginning is half done
 
Gayathri Prasad
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
We can use the staic variables and static methods in the abstract class just like how we use them in normal classes the normal restrictions hold good and they are
1. They can only call other static methods (in case of static methods)
2.The static methods can only access the static data
3. They cannot refer "this" or "super" in any way.
The abstract classes are always extended and the static methods and static variables are used to make the method or variable common to all the objects and they are class but not object dependent.
Cheers,
Gaya3
-------------------------------------------------
Beginning is half done
 
reply
    Bookmark Topic Watch Topic
  • New Topic