The IDE I'm using is idea, and the places where eclipse may be set up are different
1. Encoding of source files
When writing. java files in various Ides, there is an encoding that the IDE stores files on the machine in this encoding format, such as my settings, to set the S.java file to GBK format
2. At compile time, Javac will read the file in the specified encoding format and then compile it into Unicode format.
For example, I joined encoding GBK this sentence.
3. The runtime also needs to parse the corresponding Unicode string according to the specified encoding format and then display
Like my source code.
Package com.spring.test;/** * Created by Brady on 15-1-14. */public class S {public static void Main (string[] args) { System.out.println ("Chinese");} }
To set the encoding format environment variable at run time
In the console you can clearly see that the runtime uses the character set environment variable
You can see that the correct results have been printed out
Java Coding Issues