public class PurpleDie extends Die { public PurpleDie() { super(); } /** roll the die */ @Override public void roll() { this.sideUp = 6; } // this is overloading the getSideUp.. public String getSideUp(int length) { int a = this.getSideUp(); return Integer.toString(a); } public static void main( String[] args ) { PurpleDie d; d = new PurpleDie(); d.roll(); System.out.println( d ); String six = "6"; String ret = d.toString(); System.out.println( six + " " + ret ); if (six == ret) { System.out.println( "they are the same" ); } else { System.out.println( "they are the different" ); } if (six.equals(ret)){ System.out.println( "they are the same" ); } else { System.out.println( "they are the different" ); } } }