Just need it typed up for 5 stars. import java. io. *; import java. util. Scanne
ID: 3661049 • Letter: J
Question
Just need it typed up for 5 stars.
import java. io. *; import java. util. Scanner; import java. util. arrayList; class File_Reader { Scanner objReader = null; String objURL = null; arrayList objContent = new arrayList(); public File_Reader(String Text_File) { try { objURL = Text_File; objReader = new Scanner(new File(objURL)); } catch (Exception ex){ objReader = null; } } public void Set_File(String Text_File){ try { objURL = Text_File; objReader = new Scanner(new File(objURL)); } catch (Exception ex){ objReader = null; } } public arrayList Get_Content(){ String Item = null; if (objReader != null){ while (objReader. hasNext()){ Item = objReader. nextLine(); objContent. add(Item); } } return objContent; } }Explanation / Answer
import java.io.*; import java.util.Scanner; import java.util.ArrayList; class File_Reader{ Scanner objReader = null; String objURL = null; ArrayList objContent = new ArrayList (); public File_Reader(STring Text_File) { try{ objURL= Text_File; objReader = new Scanner (new File(objURL)); } catch (exception ex){ objReader = null; } } public void Set_File(String Text_File){ try{ objURL = Text_File; objReader = new Scanner (new File (objURL)); } catch (Exception ex) { objReader = null; } } public ArrayList Get_Content (){ String Item = null; if (objReader !=null){ while (objReader.hasNext()){ Item = objReader.nextLine(); objContent.add(Item); } } return objContent; } }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.