/* * @topic T10009 First day in class demo * @brief class CDemo demonstartes immutable strings in Java */ package week1demo; public class CDemo { private int dummy; // constructors public CDemo() { } public CDemo( int value ) { value = 456; dummy = value; } // operations public void printValue() { System.out.println( dummy ); } public void printString( String str ) { str = "Goodbye"; String mycopy = str; System.out.println( str ); str = "12345"; System.out.println( str ); str = "Goodbye"; System.out.println( str ); if ( mycopy == str ) { System.out.println( "mycopy == str" ); } else { System.out.println( "mycopy != str" ); } } static public void printDefaultValue() { System.out.println( "-1" ); } }//class CDemo