Latest topics

Static Variable in Java

Go down

Static Variable in Java

Post by bangalorewebguru on Fri Jul 31, 2015 2:46 pm

Class variables also known as static variables are declared with the static keyword in a class, but outside a method, constructor or a block.


Posts : 1199
Earned : 4877
Credit : 4
Join date : 2013-10-15
Age : 25
Location : Bangalore

View user profile

Back to top Go down

Re: Static Variable in Java

Post by tyagi on Fri Mar 31, 2017 6:54 pm

1.It is a variable which belongs to the class and not to object(instance)
2.Static variables are initialized only once , at the start of the execution . ...
3.A single copy to be shared by all instances of the class.
4.A static variable can be accessed directly by the class name and doesn't need any object.

Thank you~!


Posts : 156
Earned : 312
Credit : 0
Join date : 2017-01-23

View user profile

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum