I am trying to add the arrays in the method anArray, but when i try to see the value, which should be 134/3 , it is returning "Their Test Sum = 33500" instead of the value of 134/3, why is it printing such a large number?
public class FinalProject { /** * @param args the command line arguments */ public static void main(String[] args)throws IOException { //Choice Of Options: //File I/O * //Arrays //"String Class" Substr, CharAt etc. int testScores = readFile(); System.out.println("My Test Scores Avg: " + testScores); anArray(); } public static int readFile () throws IOException { FileInputStream fstream = new FileInputStream("c:/scores.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); //Reading File String strLine; int myScores = 1; while ((strLine = br.readLine ()) != null) { myScores = Integer.parseInt(strLine); return myScores; } return myScores; } public static void anArray () { int[] hisTest; hisTest = new int [3]; hisTest[0] = 33; hisTest[1] = 50; hisTest[2] = 51; System.out.println("Their Test Sum = " + hisTest[0] + hisTest[1] + hisTest[2]/3); } }