Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8512105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:11:30+00:00 2026-06-11T04:11:30+00:00

I want to create a .dat file in java which doesn’t exist. I don’t

  • 0

I want to create a .dat file in java which doesn’t exist. I don’t know how to manually create it either. I know that the following code:

 File f = new File(file); 

is used for the file, but what exactly is the code for a file which doesn’t exist. In other words create a new file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:11:31+00:00Added an answer on June 11, 2026 at 4:11 am

    A statement like File f = new File(file); will not create a file on disk. Class java.io.File only represents a file path, not the actual file on disk.

    To create a new file, open a FileOutputStream for it, which you can then use to write data to the file.

    OutputStream out = new FileOutputStream("C:\\Temp\\filename.dat");
    try {
        // Write data to 'out'
    } finally {
        // Make sure to close the file when done
        out.close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want create wordpress website into which I want create user management... That means
I am using java.util logging classes to create a rolling file appender. I want
I found that if you create a file called "usertype.dat" in visual studio's IDE
i want create a custom json data from the mssql 2008 results so that
I want create a excel with Apache POI in java and I must insert
I want create module which update list of usb devices automatically (not only mass
I want to create a file, save data and then append some information to
I want to read a text file word by word in Qt4 (to which
i'm doing tokenizing a text file in java. I want to read an input
I am having a text file that contains users name.I want to extract users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.