I got this code:
import java.util.*;
import java.io.*;
public class Oblig3A{
public static void main(String[]args){
OrdAnalyse O = new OrdAnalyse();
OrdAnalyse.analyseMet();
}
}
class OrdAnalyse {
public static void analyseMet() {
Scanner Inn = new Scanner(System.in);
try {
File skrivFil = new File("Opplysning.txt");
FileWriter fw= new FileWriter(skrivFil);
BufferedWriter bw = new BufferedWriter(fw);
Scanner lesFil = new Scanner("Alice.txt");
int i=0;
int totalOrd=0;
int antUnikeOrd=0;
String[] ordArray = new String[5000];
int[] antallOrd = new int[5000];
while(lesFil.hasNext()) {
String ord = lesFil.next().toLowerCase();
totalOrd++;
boolean ut=false;
int y=0;
int z=0;
for(i=0; i<ordArray.length; i++) {
if (ord.equals(ordArray[i])) {
antallOrd[i]++;
ordFraFor=true;
}
}
if(ordFraFor=false) {
antUnikeOrd++;
z=0;
boolean ordOpptelling=false;
while(ordOpptelling=false) {
if(ordArray[z] == null) {
ordArray[z] = ord;
antallOrd[z]++;
ordOpptelling=true;
}
z++;
}
}
}
System.out.println(ordArray);
}catch (Exception e){
System.out.print(e);
}
}
}
And this is supposed to do some heavy counting while reading the words out of a file one by one. However, when I finally try to print the array to terminal just check whether it is okay or not, before I start working on making the program able to write it to a text-file, it just gives an error which reads: [Ljava.lang.String;@163de20 But I do not know how and where to check for errors in this case? Any help?