/** Program: EssentialCasting Purpose: simple demonstration of Java operators. @author john@december.com @version 1.05; 21 Nov 95 Note: converted to 1.00 beta Output: 3 42.001 Survey says: 42 Survey says: true */ class EssentialCasting { public static void main (String args[]) { int myInteger = 42; float myReal = 3.987f; boolean myTruth = true; String aPhrase; float aReal; float anInteger; anInteger = (int)myReal; // floating to integer System.out.println(anInteger); aReal = myInteger + 0.001f; // floating expression System.out.println(aReal); aPhrase = "Survey says: " + myInteger; // integer to string System.out.println(aPhrase); aPhrase = "Survey says: " + myTruth; // boolean to string System.out.println(aPhrase); } }