«

»

May
20

What does transient mean in Java?

«transient» is a keyword used to prevent serialization of certain variables in a class. It’s useful if we have to manipulate a sensitive variable which should not appear in a file or a stream (e.g passwords or some variables in games programs).

Sample :

class SampleClass implements Serializable {
        public transient int var1 = 1;
        public int var2 = 2;
}

If we instantiate this class, the value of var1 is O. A transient variable is initialized by the default value of its type.

 

See also :

Share it with your freinds on Facebook Tweet it to your freinds on Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

10 comments

No ping yet

  1. Computer Errors says:

    I love your site. Very useful, well writed article. If you want check out my website http://www.computererrorfix.com/2012/04/09/how-to-fix-windows-bsod-error-0x0000f4/. I think you will like it!

  2. Naturally Weight Lose says:

    Hey There. I found your blog using msn. This is a very well written article. I’ll make sure to bookmark it and come back to read more of What does transient mean in Java? » . Thanks for the post. I will certainly return.

  3. grabatron app android says:

    What does transient mean in Java? » I was recommended this web site by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my difficulty. You’re wonderful! Thanks! your article about What does transient mean in Java? »Best Regards Cindy

  4. Juliann Wiklund says:

    Couldn’t have said it better myself.

  5. Anastasia Bergmeyer says:

    It is best to participate in a contest for one of the best blogs on the web. I’ll suggest this website!

  6. Tyson F. Gautreaux says:

    I simply want to tell you that I am just newbie to weblog and seriously savored you’re web site. Almost certainly I’m planning to bookmark your site . You surely have fantastic writings. Appreciate it for sharing your website page.

  7. google seo says:

    30 minute backlinks how to seo backlink service backlinks

  8. iphone 5 release date says:

    when you have proper sales training, you can always sell any item that you want wether it online or offline*

  9. car repos says:

    Such a well written post.. Thnkx for sharing this post !! Also you can check my ??

  10. iphone 5 says:

    Our SQL tutorial will teach you how to use SQL to access and manipulate data in:

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

WP SlimStat