0
点赞
收藏
分享

微信扫一扫

Java 字节流写数据加异常处理

晗韩不普通 2022-02-16 阅读 63
FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("D:\\code\\java\\Stream\\fos.txt");
            fos.write("hello".getBytes());
            
        } catch (IOException e) {
            e.printStackTrace();
            
        }finally {
        
            try {
                fos.close();
                
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
举报

相关推荐

0 条评论