Which of the following code segments creates a new file named address.txt, writes the following two lines to the file, and then closes the file?
Bob Johnson
Somewhere USA
a. ```Dim addressFile As System.IO.StreamWriter
addressFile = System.IO.File.CreateText(“address.txt”)
addressFile.Write(“Bob Johnson”)
addressFile.Write(“Somewhere USA”)
address.txt.Close()
```
b. ```Dim addressFile As System.IO
addressFile = System.IO.File.CreateText(“address.txt”)
addressFile.WriteLine(“Bob Johnson”)
addressFile.WriteLine(“Somewhere USA”)
addressFile.Close()
```
c. ```Dim addressFile As System.IO.StreamWriter
addressFile = System.IO.File.CreateText(“address.txt”)
addressFile.WriteLine(“Bob Johnson”)
addressFile.WriteLine(“Somewhere USA”)
addressFile.Close()
```
d. ```Dim addressFile As StreamWriter
addressFile = System.IO.File.CreateText(“address.txt”)
addressFile.PrintLine(“Bob Johnson”)
addressFile.PrintLine(“Somewhere USA”)
Close()
```
c. ```Dim addressFile As System.IO.StreamWriter
addressFile = System.IO.File.CreateText(“address.txt”)
addressFile.WriteLine(“Bob Johnson”)
addressFile.WriteLine(“Somewhere USA”)
addressFile.Close()
```
You might also like to view...
The process of determining if an array contains a particular key value is called ___________ the array.
Fill in the blank(s) with the appropriate word(s).
What is the purpose of using a mnemonic code for data?
What will be an ideal response?