Https://mp.weixin.qq.com/s/TsTiLVF5D07-wbDMk9bsyQIt's not serious, it's not really going to implement a Chinese programming language.many years ago, a classmate sent me the Java code to say to help change. After getting shocked, are not seen in the usage. Two of them are:
- Java serialization: Storing the object in a file, then reading the deserialization, or the same object as before, is magical;
- Chinese method Name: The method name of some classes inside is Chinese!
The principle is actually very simple, the Java language source file all the characters are using UTF encoding, using 16-bit two-byte storage, so basically any language symbols can be used to encode, Chinese, Korean, Japanese, Arabic and so on. today, I'll show you the Java written in Chinese. The editor uses IntelliJ idea. 1. First create a class that calls people:? ?2. Add basic attributes: Name, gender, age:? ?3. Add a construction method:? ?
- Generate Getter/setter:
? ?
- To facilitate testing, overwrite the ToString () method:
? ?
- Create a main function to run the test:
? ?The results of the operation are as follows:? ?
- Refactoring 1: Change the age to int type:
? ?The results of the implementation are as follows:? ?
- Refactoring 2: Move the class "people" into the package "Chinese package":
? ?Run it:? ?The results are fine. isn't it amazing?
Have fun-Implement a Java-based Chinese programming language