Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

Welcome, Guest
Username Password: Remember me

Differences between public, private, protected
(1 viewing) (1) Guest
All your queries regarding
PHP Installation,
Binding Apache-PHP-MySQL,
and tonnes more... will be solved in this forum
  • Page:
  • 1
TOPIC:

Differences between public, private, protected

Differences between public, private, protected 9 months, 1 week ago #779

  • palak
  • OFFLINE
  • Senior Boarder
  • Posts: 55
  • Karma: 0
What are the differences between public, private, protected, static, transient, final and volatile?

Re: Differences between public, private, protected 9 months, 1 week ago #781

  • juber
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Public - Public variables declared can be accessed everywhere

Protected - Protected variables limits access to inherited and parent classes

Private - Private variables limits visibility only to the class that defines the variables.

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.

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.
  • Page:
  • 1
Time to create page: 1.26 seconds
OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download