Question: //JAVA// im new to reading files and for this program i need to read in my file and i have to find the most repeated
public static void main(String[] args) \{ I/ TOD0 Auto-generated method stub Scanner str = new Scanner(System.in); String filename= str. nextLine(); try \{ ArraylisteString>input=getMode(filename); System.out. println(input); \} catch(FileNotFoundException e) \{ System.out.println("No file"); 3 public static ArraylisteString getinput(String filename) throws FileNotFoundException\{ Arraylist> input = new Arraylist (); File file = new File(filename); Scanner in = new Scanner(file); while(in.hasNextLine()) \{ input. add (in.nextline()); \} in. close(); return input; 3 public static Arraylist getMode(String filename) \{ String oldname=" "; 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
