package class3_2_OfficeHours_CharArithmeticAndBigFloats_start;// Dr. Yoder. MSOE. 21 March 2017 /** * The purpose of this class is to answer the question: * Why does the compiler as integers instead of concatenating them * as strings? * * The answer to the question is that (1) sometimes you want to add characters * as numbers (See the CaesarCipher class for an example) and * (2) It is very easy to concatenate characters as strings if you want to. * Just add a ""+ at the beginning, as in the last line of this example program. */ public class AddingChars { public static void main(String[] args) { char firstInitial = 'J'; char secondInitial = 'D'; System.out.println("(int)firstInitial = " + (int) firstInitial); System.out.println("(int)secondInitial = " + (int) secondInitial); System.out.println(firstInitial+secondInitial); System.out.println(""+firstInitial+secondInitial); } }