package mjava.lang;

public final class MString {
	/** 我们需要一个存储空间 */
	private final char[] value;

	/** 保存字符串长度，一经初始化便不会改变 */
	private final int count;

	public MString() {
		
		// http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.newarray
		this.value = new char[0];
		this.count = 0;
	}

	public MString(char[] value) {
		this.value = value;

		// Java有专门的指令arraylength来获取数组的长度
		// 见http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.arraylength
		int size = value.length;
		this.count = size;
	}
}

@@ -170,11 +170,9 @@
 ) %7B%0A
-%09%09
 %0A
+
 %09%09//
@@ -374,10 +374,11 @@
 %E6%9C%89%E4%B8%93%E9%97%A8%E7%9A%84
-%E6%8C%87%E4%BB%A4
+%E5%AD%97%E8%8A%82%E7%A0%81
 arra
@@ -509,16 +509,16 @@
 length;%0A
-
 %09%09this.c
@@ -532,11 +532,102 @@
 size;%0A%09%7D
+%0A%0A%09public char%5B%5D getValue() %7B%0A%09%09return value;%0A%09%7D%0A%0A%09public int length() %7B%0A%09%09return count;%0A%09%7D
 %0A%7D%0A

Update MString.java