I am trying to use files that contain long strings of numbers by inputing them as arguments. Then I am trying to find the hamming distance between the two strings. Right now I have errors on lines 7,8,9 and 11. They say "cannot find symbol: method length()." I am very new to java so I am wondering if I am using scanner incorrectly or I messed up somewhere else to cause these errors. Any insight would be appreciated.
If it helps the files I am importing are of the form:
13413.123,
12314.434,
12353.809,
and so on
public static double calcDifference(String[] args) throws IOException {
Scanner scanner =
new Scanner(new File(args[0]));
Scanner scanner2 =
new Scanner(new File(args[1]));
double a = 0;
for (double x = 0; x < scanner.length(); x++) {
for (double y = 0; y < scanner2.length(); y++) {
if (scanner.charAt(x) == scanner2.charAt(y)) {
a += 0;
} else if (scanner.charAt(x) != scanner2.charAt(y)) {
a += 1;
}
}
}
return a;
}