Forums Register Login

Transient Variable

+Pie Number of slices to send: Send
Its written in R&H that transient variables cannot be Static or
final. See Pg-90.
But the following code compiles and run fine.
Can anybody explain.
class test13{
transient static int x = 85;
transient final int y = 85;
transient final static int z = 85;
public static void main(String args[]){
print();
}
public static void print(){
System.out.println("Test");
}
}
Thanx.
+Pie Number of slices to send: Send
OK; I'm on vacation on The Beach (Atlantic Ocean)... Translation: I have no compiler with me
But if you are willing to accept a somewhat educated answer
I don't see the conflict in a variable being static, final, or transient.
For Serialization purposes, neither static nor transient variables are included in the byte stream that is the result of Serialization.
+Pie Number of slices to send: Send
From R&H's errata : http://scooter.sybex.com/erratatracking.nsf/weberrataform?OpenForm&ISBN=2700
Page 90
Corrected in the third printing: The Note on the page should be deleted.
+Pie Number of slices to send: Send
Thanx Lisa
Ashish
And then the flying monkeys attacked. My only defense was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 544 times.
Similar Threads
Which of the Following is True?
Where should we write static final transient
static final transient int i=100??
valid combinations of Modifiers like static,native,transient etc
Miscellenous Code for Transient Variable
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:08:17.