aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes static transients possible??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "static transients possible???" Watch "static transients possible???" New topic
Author

static transients possible???

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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
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.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
There's a smiliar discussion on another thread.
Please checkout http://www.javaranch.com/ubb/Forum24/HTML/001550.html
Ajith

[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
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
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
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
a nice fact!!


I am the most eligible bachelor in whole world, but only known in limited territory!!!
Digital Intoxication Blog
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: static transients possible???