为什么我每次执行 Java 程序时都会收到这些奇怪的单词?
温馨提示:
本文最后更新于 2024年04月12日,已超过 48 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我。
Every time I try to run this code
import java.io.File;
import java.util.Formatter;
import java.util.Scanner;
public class training{
public static void main(String[] args) {
try {
Formatter f = new Formatter("testing.txt");
f.format("%s %s %s", "1", "John", "Smith \r\n");
f.format("%s %s %s", "2", "Amy", "Brown");
f.close();
File file = new File("testing.txt");
Scanner sc = new Scanner(file);
while (sc.hasNext()) {
System.out.println(sc.next());
}
sc.close();
} catch (Exception e) {
System.out.println("ERROR!");
}
}
}
I'm getting, yes, the correct result, but before that I'm getting some paceStorage and x5credhat.java I don't know why, how can I delete these strange characters ?
正文到此结束
- 本文标签: 家庭宠物
- 本文链接: https://www.coder6.net/article/2216
- 版权声明: 本文由蚂蚁原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权
热门推荐
-
浏览(193) 评论(0)