Question: ts] Use the class stutter to answer questions (a)-(d) below: 1 I Jeff Offutt - June 1989, Java version 2003 3 I/ stutter checks for
ts] Use the class stutter to answer questions (a)-(d) below: 1 I Jeff Offutt - June 1989, Java version 2003 3 I/ stutter checks for repeat vords in a tezt file 4 I1 It prints a list of repeat vords, by line nusber 5 // stutter vill accept standard input or a list 6 I of file names 8 iport java.io. 10 class stutter 12 Class variables used in nultiple methods private static boolean lastdelimit true; 13 14 private static String curWordprevword 15 private static char delinits 16 17 18 I/OOOOOSSOSOO. 19 // nain par?03 the arguments, decides if ?tdin 20 I/ or a file nane, and calls stut O 22 public static void nain (String args) throus IOException 23 24 25 26 String fileNane; FileReader nyFile BufferedReader inFile null; 28 f (args.length0) 29 I no file, use stdir inFilenev BufferedReader (ne InputStrea Reader (Systen.in)) 31 else 34 35 36 fileNae-args t0] if (fileNane null) II no file name, use stdin inFile neu BufferedReader( Input StreamReader (Systes.in)D else Ifile nane, open the file 40 41 myFile # new FileReader (fileName); inFile-new BufferedReader (myFile): 43
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
