Demonstration of mkdir( ) and mkdirs( ) in Java

Поделиться
HTML-код
  • Опубликовано: 11 дек 2024
  • НаукаНаука

Комментарии • 5

  • @darshanlahoti7391
    @darshanlahoti7391 4 года назад

    can i run mkdir program on online editor/compiler

  • @junigates
    @junigates 7 лет назад +1

    thanks it was informative

    • @codehubz
      @codehubz  7 лет назад

      u r welcome. God bless u.

  • @sakibjobaid6667
    @sakibjobaid6667 6 лет назад

    Without using mkdirs() ,only by using mkdir () we can also create such nested files. Then what is the difference between these two methods.

    • @codehubz
      @codehubz  6 лет назад

      File f = new File("non_existing_dir/someDir");
      System.out.println(f.mkdir());
      System.out.println(f.mkdirs());
      will yield false for the first [and no dir will be created], and true for the second, and you will have created non_existing_dir/someDir
      Ref:
      stackoverflow.com/questions/9820088/difference-between-mkdir-and-mkdirs-in-java-for-java-io-file