logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • How to create a file on the hard disk by using File class object?


  • Correct Answer
  • We can use the following method call: boolean createNewFile(); This method creates a new file on the HD If a file is already existing with the name given in the constructor then this method does not creates file on HD If file is successfully created then this method returns true If file is already existing on the HD then this method returns false This method may throw IOException whenever IO error is generated while creating file on HD 


  • Technology problems


    Search Results


    • 1. Why interface data is public?
    • Discuss
    • 2. Why interface data is final?
    • Discuss
    • 3. Why interface data is static?
    • Discuss
    • 4. What is abstract method?
    • Discuss
    • 5. why protected modifier?
    • Discuss
    • 6. How to create Directory on the HD?
    • Discuss
    • 7. How to check that the file object is pointing a file on HD?
    • Discuss
    • 8. How to check that whether the file object is pointing a folder or not?
    • Discuss
    • 9. How to get last modified date of a file?
    • Discuss
    • 10. How to get contents of the folder?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment