Hi Michael, Here is what I have to say : Volatile : Only variables may be volatile. Declaring a variable volatile implies that they can be modified asynchronously. Transient : When a variable is declared as transient, it means that it will not get serialised with the object. In the second example of Sri's post, a transient variable is declared in an interface. This will not compile, and you will get an error, "modifier transient not allowed here". This is because the member variables of an interface are always public, static and final by default. So it wont allow you to declare them as transient. Hope this helps. Regards Mandar
Howdy! You do *not* need to know exactly how volatile, transient, and strictfp work. But you *do* need to know where / to what they can be applied. For example, you need to know: * Only non-local variables can be volatile (methods, classes, and local variables cannot be volatile) * Only non-local variables can be transient (methods, classes, and local variables cannot be transient) * Variables cannot be made strictfp, only classes and methods may be strictfp * You cannot make abstract methods (including interface methods) strictfp That's a start : ) My recommendation is to learn enough about what they do so that you'll be able to better remember where it makes sense to use them and where it does not. For example, knowing that marking a variable transient means, "skip this variable when saving the object's state during serialization", makes it easier to remember that 'transient' is about instance variables and not methods or classes. And if you remember that strictfp is about 'behavior' rather than state, it makes more sense that strictfp can be applied to methods but not variables. (Then you still have to remember that strictfp can be applied to classes, but that's just a way of saying, "make every method in the class strictfp") cheers and good luck, Kathy
Joined: Nov 27, 2002
thanks to all guys
subject: transient volatile strictfp 's position in SCJP1.4!