• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Files

 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
File f = new File("hello.test");
FileOutputStream out = new FileOutputStream(f);
Select the one right answer.
the answer is a . but File does not create a new file
then how come the answer is a??
Create a new file named "hello.test" if it does not yet exist. It also opens the file so you can write to it and read from it.
Create a new file named "hello.test" if it does not yet exist. The file is not opened.
Open a file named "hello.test" so that you can write to it and read from it, but does not create the file if it does not yet exist.
Open a file named "hello.test" so that you can write to it but cannot read from it.
Create an object that you can now use to create and open the file named "hello.test," and write to and read from the file.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Creating a File object can't create a new file - but creating a FileOutputStream (or a RandomAccessFile) can!
 
Danger, 10,000 volts, very electic .... tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic