/* * Author: G Towell * File: HH.java * Desc: Driver for in-class demo of static variables * This class drives actions stemming from the class HW. * The point is to show the difference between static and instance variables **/ public class HH { /********************** * main * @param args not used * Driver code **********************/ public static void main(String[] args) { System.out.println("HH"); HW hw1 = new HW(); HW hw2 = new HW(); hw1.publicint=1; hw1.staticint=1; System.out.println("HW1 " + hw1.publicint + " " + hw1.staticint); hw2.publicint=2; hw2.staticint=2; System.out.println("HW1 " + hw1.publicint + " " + hw1.staticint); System.out.println("HW2 " + hw2.publicint + " " + hw2.staticint); } }