• 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

Transient & Static Variables

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Khalid's book states:Pg126
Transient modifier should not be specified for static variables as these do not belong to objects
But later in the problem 4.26 Pg 130
Is this legal declaration?
final transient static private double PI = 3.141592
The answer is true.
Can someone please explain?
thanks
veena
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out this link a little further down this forum:
http://www.javaranch.com/ubb/Forum24/HTML/004765.html
Transient class can be declared as static and final. RHE reported this wrong and corrected it on the errata sheet.
Bill
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bill,
I would like to correct a small error, transient cannot be
applied to a class or a method, it can only be applied to
variables.
read the line
" Transient class can be declared as static and final. RHE reported this wrong and corrected it on the errata sheet "
which you had written.
------------------
Regards,
V. Kishan Kumar
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic