Java I/O How to - Get the default encoding of your computer








Question

We would like to know how to get the default encoding of your computer.

Answer

public class MainClass {
  public static void main(String[] a) {
    System.out.println(System.getProperty("file.encoding"));
  }
}

The code above generates the following result.