• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

static transients possible???

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?!!
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fixed it. My obsession with punctuations made me put a period even at the end of the URL
Thanks a bunch
Ajith
 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a nice fact!!
 
Arch enemy? I mean, I don't like you, but I don't think you qualify as "arch enemy". Here, try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic