aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface non-access modifiers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interface non-access modifiers" Watch "Interface non-access modifiers" New topic
Author

Interface non-access modifiers

Andreas Sandberg
Ranch Hand

Joined: Sep 14, 2005
Posts: 31
Folks,

Since interfact instance (non-local) variables are public static and final, why can they not have the keywords volatile or transient applied? Perhaps it doesn't make sense to use the keyword transient as the instance variables already belong to the class and therefore any object or request to that variable must reconcile it's own copy from main memory so there is never a chance of a race type condition. Also, I know transient is to be used for specifying when an instance variable shouldn't be serialized, correct? So are static variables never serializable then? Thanks for the help!

-Andreas


"When the compilers not happy ain't nobody happy"
agrah upadhyay
Ranch Hand

Joined: Sep 01, 2005
Posts: 579
Folks,

Since interfact instance (non-local) variables are public static and final, why can they not have the keywords volatile or transient applied? Perhaps it doesn't make sense to use the keyword transient as the instance variables already belong to the class and therefore any object or request to that variable must reconcile it's own copy from main memory so there is never a chance of a race type condition. Also, I know transient is to be used for specifying when an instance variable shouldn't be serialized, correct? So are static variables never serializable then? Thanks for the help!

I Think You got answer of your first problem.If you are left with
why final and volatile can't come together then remember
that final variables can not be changed..........but volatile means its
value can be changed anytime.So final and volatile together are contradictory.Right?


<i>--Agrah Upadhyay--</i><br />Final Year B.Tech SCJP,SCWCD,SCBCD <br /> <br /><b>Now since the real test for any choice is having to make the same choice again,knowing full well what it might cost.</b>-Oracle
Andreas Sandberg
Ranch Hand

Joined: Sep 14, 2005
Posts: 31
Doh! Thanks for pointing the obvious out to me. I thought too much about that question instead of steping back for a second. Guess I've studied for enough today. Thanks though!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interface non-access modifiers
 
Similar Threads
Is transient allowed with static?
Serialization
final and transient
why a transient variable can be declared with static modifier??
Doubt in StackOverflowError