java - 如何修复 IOException
问题描述
我为此尝试了几个文件路径,但即使文件存在,仍然得到 IOException 这是我的代码:
public static void main(String[] args) {
String [] letters = {"a", "b"};
Object ob = new object(letters);
ob.training(new File("C:/Users/Dell/Desktop/train.txt"));
ob.classify(new File("C:/Users/Dell/Desktop/data.txt"), new File("C:/Users/Dell/Desktop/classify.txt"));
}
我在训练和分类方法中使用了 throws 语句,但它仍然会要求我在 main 方法中使用 throws 语句,当我这样做时它不会运行。或者它会运行但根本没有通过名为 CodeGrade 的程序的编译测试。谁能帮我解决这个问题?
解决方案
推荐阅读
- jenkins - 使用詹金斯和加特林运行构建时遇到问题
- python - 得到与老师不同的结果
- chat - 如何将 Zoom 聊天中的文本“路由”到另一个应用程序(如 Max/MSP)。(self.learnprogramming)
- reactjs - 使用来自 Redux 状态的数据更新功能组件本地状态
- python - 残差图诊断以及如何改进回归模型
- python - 如何使用 python 为图像生成关键字、主题标签或标签?
- excel - Excel/VBA 组合表格
- java - 使用 jSerialComm 库的串行端口访问应用程序未收到 LISTENING_EVENT_DATA_AVAILABLE 事件
- javascript - 从 Ajax 中的响应映射中获取值并在 HTML/JSP 中呈现它
- django-views - 未找到 Django 错误:服务器日志中的 /NONE