File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sumeet H Singh
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Can anyone explain why cant we use these modifiers with instance variables? (for each of these modifiers)

Regards,
Sumeet
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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++?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic