Dec 13, 2011

What are the differences between public, private, protected, static, transient, final and volatile?

Public: Public declared items can be accessed everywhere.
Protected: Protected limits access to inherited and parent
classes (and to the class that defines the item).
Private: Private limits visibility only to the class that defines
the item.
Static: A static variable exists only in a local function scope,
but it does not lose its value when program execution leaves this scope.
Final: Final keyword prevents child classes from overriding a
method by prefixing the definition with final. If the class itself is
being defined final then it cannot be extended.
transient: A transient variable is a variable that may not
be serialized.
 
volatile:
 a variable that might be concurrently modified by multiple
threads should be declared volatile. Variables declared to be volatile
will not be optimized by the compiler because their value can change at
any time.

4 comments:

  1. Actually I read it yesterday but I had some thoughts about it and today I wanted to read it again because it is very well written. הדפסת כיתוב על חולצה

    ReplyDelete
  2. Way cool! Some admirable sentiments! I appreciate you writing this article and furthermore the remainder of the site is great.

    tech news

    ReplyDelete
  3. Login Your roboforex login Account To Read The Latest News About The Platform.s

    ReplyDelete