Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

why does this program write a chinese character!?

800577Dec 2 2008 — edited Dec 3 2008
package testfilewriter;

import java.io.*;


public class Main {
    
    static FileWriter obj;

    public static void main(String[] args) {
        try
        {
            obj = new FileWriter("/a.txt",true);
            obj.write("hi!");
            obj.flush();
            obj.close();
        }
        catch(Exception e)
        {
            System.out.println("exception");
        }
       
    }

}
netbeans on mac with default language US english. the program writes a chinese character to the file instead of hi!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 31 2008
Added on Dec 2 2008
26 comments
990 views