Не проходит условие "В методе main класса Solution необходимо использовать RandomAccessFile, который должен использовать файл, который приходит первым параметром". Что не так?
Замена try with resources на обычный try не помогает.
package com.javarush.task.task32.task3210;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
/*
Используем RandomAccessFile
*/
public class Solution {
public static void main(String... args) {
try (RandomAccessFile raFile = new RandomAccessFile(new File(args[0]), "rw")){
int posInFile = Integer.parseInt(args[1]);
String textInArgs = args[2];
byte[] arr = new byte[textInArgs.getBytes().length];
raFile.seek(posInFile);
raFile.read(arr, 0, textInArgs.getBytes().length);
String textInFile = new String(arr);
raFile.seek(raFile.length());
if (textInArgs.equals(textInFile)) {
raFile.write("true".getBytes());
} else {
raFile.write("false".getBytes());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}