Have fun-Implement a Java-based Chinese programming language

Source: Internet
Author: User
Tags wrapper

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:
    1. Java serialization: Storing the object in a file, then reading the deserialization, or the same object as before, is magical;
    1. 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:? ?
    1. Generate Getter/setter:
? ?
    1. To facilitate testing, overwrite the ToString () method:
? ?
    1. Create a main function to run the test:
? ?The results of the operation are as follows:? ?
    1. Refactoring 1: Change the age to int type:
? ?The results of the implementation are as follows:? ?
    1. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.