Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 扫描仪可以用来写入文件吗?_Java_Android_Java.util.scanner - Fatal编程技术网

Java 扫描仪可以用来写入文件吗?

Java 扫描仪可以用来写入文件吗?,java,android,java.util.scanner,Java,Android,Java.util.scanner,我有以下代码片段 /* I have got the file. Now moving to the desired place */ Scanner in_chap = new Scanner(chap); in_chap.useDelimiter(qa_delimiter); while (in_chap.hasNext()) { String str = get_my_info(); /* Now I need to replace the the

我有以下代码片段

    /* I have got the file. Now moving to the desired place */
Scanner in_chap = new Scanner(chap);
in_chap.useDelimiter(qa_delimiter);
while (in_chap.hasNext()) {
    String str = get_my_info();
            /* Now I need to replace the the current line with str */
     }

有没有办法使用scanner引用将str写入新的偏移量?如果我不能,还有别的办法吗?我需要用扫描器才能到达那条线。现在我想用新字符串替换它…

不,正如名字所说,它是一个
扫描仪,它只用于阅读,不用于写作

有没有办法使用scanner引用将str写入新的偏移量


否。
扫描仪
类仅用于阅读。

没有扫描仪对象仅用于输入。否<代码>扫描仪
提供只读访问。@pst:(提前了几分之一秒!)