package uk.ac.leeds.ccg.andyt.tests.java; import java.util.HashSet; public class StaticTest { //private static int i; //private static Integer id; public static void passAroundPrimatives0() { //i = 1; Integer id = new Integer( 1 ); //Object o = ( Object ) id; HashSet hs = new HashSet(); hs.add( id ); //System.out.println("hs.size() " + hs.size() ); //passAroundPrimatives1()System.out.println("id " + id.intValue() );; passAroundPrimatives1( id ); //passAroundPrimatives1( o ); passAroundPrimatives1( hs ); //System.out.println("i " + i ); System.out.println("id " + id.intValue() ); System.out.println("id " + id ); //System.out.println("o " + ( ( Integer ) o ).intValue() ); System.out.println("hs.value " + ((Integer)hs.iterator().next()).intValue() ); } //public static void passAroundPrimatives1() { // i = 2; //} //public static void passAroundPrimatives1( int i ) { // i = 2; //} public static void passAroundPrimatives1( Integer id ) { id = new Integer( 2 ); System.out.println( id ); } //public static void passAroundPrimatives1( Object o ) { // o = new Integer( 2 ); //} public static void passAroundPrimatives1( HashSet hs ) { hs = new HashSet(); hs.add(new Integer(2)); } }