// File: StaticExample3.java // // Author: Rahul Simha // Created: August 19, 1998 // Modified: Sept 2007 // // Static class with non-static members that does work. public class StaticExample3 { static double x; // Static data static void printx () // Static method { System.out.println ("x = " + x); } public double y; // Non-static data public void printy () // Non-static method { System.out.println ("y = " + y); } public static void main (String[] argv) { x = 5.34; printx (); // Create an instance of the object. StaticExample3 z = new StaticExample3 (); // Then, use it. z.y = 9.67; z.printy (); } }