I'm working on a program that reads data from a file and inputs it into an array. It seems like it should work, however I get an odd output from the program (no error, it runs, just gives me a weird result).
Here's my code:
Scanner s = new Scanner(new File("../Computer/src/computers/computer.txt"));
String[] comps = new String[2];
int i = 0;
while (s.hasNextLine()) {
comps[i] = s.nextLine();
i++;
}
s.close();
System.out.println(comps);
The output that I get is:
[Ljava.lang.String;@3d62b333
BUILD SUCCESSFUL (total time: 1 second)
Also, my text file looks like this, if it's a problem with my text file:
12344555 Dell Intel 499.99
23623626 Asus AMD 299.99