/* * Casting -- telling the computer what data type you really want * Sometimes you do not need to say, but it is never wrong * Order of operations matters! * * Created: August 2023 * @author gtowell */ public class Casting1 { public static void main(String[] args) { double aDouble = 2.4; int anInt = 4; double resultDouble = aDouble * anInt; int resultInt = (int)(aDouble * anInt); System.out.println(aDouble + " * " + anInt + " = " + resultDouble); System.out.println(aDouble + " * " + anInt + " = " + resultInt); int resultIntB = (int) aDouble * anInt; System.out.println(aDouble + " * " + anInt + " = " + resultIntB); } }