public static Charset defaultCharset(){
  if (defaultCharset == null) {
synchronized (Charset.class) {
      String csn=AccessController.doPrivileged(new GetPropertyAction("file.encoding"));
      Charset cs=lookup(csn);
      if (cs != null)       defaultCharset=cs;
 else       defaultCharset=forName("UTF-8");
    }
  }
  return defaultCharset;
}

public static Charset defaultCharset ( ) { if ( defaultCharset == null ) { synchronized ( Charset . class ) { String csn = AccessController . doPrivileged ( new GetPropertyAction ( "file.encoding" ) ) ; Charset cs = lookup ( csn ) ; if ( cs != null ) defaultCharset = cs ; else defaultCharset = forName ( "UTF-8" ) ; } } return defaultCharset ; }
returns the default charset of this java virtual machine . < p > the default charset is determined during virtual - machine startup and typically depends upon the locale and charset of the underlying operating system .
