why cant transient variables be static or final? Khalid�s book says, that these do not belong to objects and cannot be static. Can someone explain the meaning of this statement? Besides i read that they have changed this statement in the errata for RHE ?!!
surya sadhu
Greenhorn
Joined: Feb 16, 2004
Posts: 13
posted
0
Hi faizaharis Try this code.... class a { static transient int a = 15; public static void main(String args[]) { System.out.println(a); } } The class got compiled and the output is 15. A transient modifier should be used only for an instance variable , not for a local variable.
[This message has been edited by Ajith Kallambella (edited May 20, 2000).]
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
Ajith: the url above doesnot work...it should be this: Transient declarations... I hope you don't mind me correcting you. I don't want you to eat your hat again, you know Regds. - satya
Finally ... [This message has been edited by satya5 (edited May 20, 2000).] [This message has been edited by satya5 (edited May 20, 2000).]
Ajith Kallambella
Sheriff
Joined: Mar 17, 2000
Posts: 5782
posted
0
Fixed it. My obsession with punctuations made me put a period even at the end of the URL Thanks a bunch Ajith
Cherry Mathew
Ranch Hand
Joined: Dec 26, 2000
Posts: 159
posted
0
Originally posted by faizaharis: why cant transient variables be static or final? Khalid�s book says, that these do not belong to objects and cannot be static. Can someone explain the meaning of this statement? Besides i read that they have changed this statement in the errata for RHE ?!!
i didnt get the answer especially why it cant be final
anjan bhushan
Ranch Hand
Joined: Dec 12, 2000
Posts: 71
posted
0
a nice fact!!
I am the most eligible bachelor in whole world, but only known in limited territory!!!
Digital Intoxication Blog