如何手动将变量分配给数组?我在下面有一个代码片段。
我不想手动放置 shortStraight[0] = "211100", shortStraight[1] = "021110" 等等。有什么帮助吗?

private String [] shortStraight;

    public Sample () {
        shorty = new String [12];
                shorty = {211100, 021110, 002111, 121100, 112100, 111200, 012110, 011210, 011120, 001211, 001121, 001112 } //this line doesn't work.

有什么帮助吗?

最佳答案

String[] shorty = {"211100", "021110", "002111", "121100", "112100", "111200", "012110", "011210", "011120", "001211", "001121", "001112"} ;

10-06 10:20