Home Tutorial Java Scjp Part10 SCJP Module-10 Question-7

 
 

Share on Google+Share on Google+
SCJP Module-10 Question-7
Posted on: July 16, 2010 at 12:00 AM
Advertisement
The sample code given below will test your understanding of creating a file and writing data onto it by using the File and FileWriter respectively.

Given a sample code:

import java.io.*;

class Test3 {
public static void main(String[] args) {
try {
File w = new File("test.txt");
FileWriter fw = new FileWriter(w);
fw.write("test message");
fw.close();
} catch (IOException e) {
System.out.println(e);
}}}

Is the above code can make a file and can write ? Choose correct option?

(A) Yes
(B) No

Answer:

(A)

Advertisement

Related Tags for SCJP Module-10 Question-7:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 16, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com