如何在Java中手动设置数组?
如何手动将变量分配给数组?我在下面有一个代码片段。 我不想手动放置如何在Java中手动设置数组?,java,Java,如何手动将变量分配给数组?我在下面有一个代码片段。 我不想手动放置shortStraight[0]=“211100”、shortStraight[1]=“021110”,等等。有什么帮助吗 private String [] shortStraight; public Sample () { shorty = new String [12]; shorty = {211100, 021110, 002111, 121100, 112100
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.
有什么帮助吗
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"} ;
投票结束,这太简单了(谷歌-“java初始化字符串数组”)嗯…哪一个?你的两个答案都不一样。这是一个合理的问题,即使在你看来这“太容易了”。