|
| Total Answers and Comments: 8 |
Last Update: August 13, 2009 Asked by: amitjhjsr |
|
| | |
|
Submitted by: muktasharad static members(data and methods)are contained within the class definition but exist and accessed by without creating an instance of the class. suppose public class StaticDemo { public static double pi=3.14; } When the JVM loads the byte code for the class description of StaticDemo, it creates a single memory location for the pi variable and loads it with the 3.14 value. This variable pi can be accessed without creating an instance of the class...
We can access the data directly using the name of the class, as in: double x = 2.0 * StaticDemo.pi;
Above answer was rated as good by the following members: pravinsharma, tanzeem khan, Mahitha Reddy.G, abhijitp, bino75 | Go To Top
|