qq1445496485
    public static void main(String[] args)
    {
        String filePath = "E:/" + "1.txt";
        String content = "这是txt文件";
        FileWriter fw = null;
        try
        {
            File file = new File(filePath);
            if (!file.exists())
            {
                file.createNewFile();
            }
            fw = new FileWriter(filePath);
            fw.write(content);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            try
            {
                fw.close();
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }

        }

    }

 

分类:

技术点:

相关文章:

  • 2022-01-27
  • 2021-12-24
  • 2022-01-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2021-06-30
  • 2022-12-23
  • 2021-12-02
相关资源
相似解决方案