ANAM FD May. 2015 | Page 69

Java Austin Rogers import java.util.Scanner,java.util.InputMismatchException public class JavaPoem { public static void main (String [] args) { Scanner reader = Scanner(System.in): System.out.print(“Enter name: “): String name = reader.next(): System.out.println(Welcome..” = name); System.out.println(“Thank you for running this program.”); System.out.println(“So few understand, “): System.out.println(“Yet those that do are so far apart.”); String example = “Initializing variables.” ; definingFunctions(“Then calling them.” , example); System.out.println(“Sometimes a programmer’s only interaction.”); try { System.out.println(“But even then, they don’t always understand.”); catch(InputMismatchException e) { System.out.println(“Try Again. Enter correct data type.”);} System.out.println(“Even with the hardships…”); System.out.println(“When the program runs smooth…”); System.out.println(The heap sighs with relief.”); reader.close();} private static void definingFunctions(String t, String s) { System.out.println(s); System.out.println(“Defining Functions”); System.out.println(t);}} 69