62 523
Assignments Done
98,7%
Successfully Done
In June 2018

Answer to Question #52580 in Java | JSP | JSF for Milini

Question #52580
3. Write a program to create a file Unicode.dat which contains rows of unicode
characters with their code number equivalent, starting at 27 and finishing with
125. If the program runs successfully, the only message your program prints on
screen is “Output file has been created: Unicode.dat’ but opening the file
shows the output below.
Expert's answer
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 *
 */
public class Unicode {
    public static void main(String[] args) {
        final String filename = "Unicode.dat";
        try {
            FileWriter fw = new FileWriter(new File(filename));
            for (int i = 27; i <= 125; i++) {
                fw.write((char) i + " " + i + "\n");
            }
            fw.close();
            System.out.println("Output file has been created: Unicode.dat");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions