Question: How do I make getters and setters for my array arr 30 import java.io.File 4 import java.io.FileNotFoundException; Ju a5 import java.sql.Array; 6 import java.util.Arrays; 7
How do I make getters and setters for my array arr
30 import java.io.File 4 import java.io.FileNotFoundException; Ju a5 import java.sql.Array; 6 import java.util.Arrays; 7 import java.util.Scanner; 9 public class Readingfiles f public static void main(String[ Jargs) throws FileNotFoundException ( 11e 12 13 14 15 16 17e 18 19 20 //made an array type integer, int[] data - readFiles ("numbers.txt") System.out.printin(Arrays.tostring(data)): public static int[] readFiles (String file) throws FileNotFoundException f try f File f new File(file); Scanner s new Scanner(f); int ctr-0; //goes through the file and counts the number of times s.next nt can be called while (s.hastlext)) ( 21 23 24 25 26 27 28 ctr++; s.nextInt): int[] arr new int[ctr]: Scanner si new Scanner(f); i30 31 32 for (int i-e;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
