This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Why cant instance variables be abstract, synchronized, strictfp and native ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why cant instance variables be abstract, synchronized, strictfp and native ?" Watch "Why cant instance variables be abstract, synchronized, strictfp and native ?" New topic
Author

Why cant instance variables be abstract, synchronized, strictfp and native ?

Sumeet H Singh
Greenhorn

Joined: Jan 03, 2009
Posts: 29
Hi all,
Can anyone explain why cant we use these modifiers with instance variables? (for each of these modifiers)

Regards,
Sumeet
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
The modifier abstract means something is missing; what can be missing from a variable?
The modifier synchronized means the block of code is under a lock; how can a variable be under a lock?
The modifier strictfp means extended floating-point arithmetic is prohibited; how can there be floating point arithmetic in a variable?
The modifier native means the block of code is written in C/C++; how can a variable be written in C/C++?
 
 
subject: Why cant instance variables be abstract, synchronized, strictfp and native ?
 
Similar Threads
HAS-A relationship problem
enums and protected modifier
Hiding Static variables/methods using instance variables/methods
access modifier in main method not allowed. Why?
final & static Constructor