我只想简单地创建一个数组:
int[] nums = {1, 2, 3};但是有一个错误:
错误: Groovyc:意外令牌:1
我该怎么办?谢谢!
import org.junit.Test;
import static org.junit.Assert.assertEquals;
class ArrayTest {
@Test
public void demonstrateArray(){
int[] nums = {1, 2, 3};
}
}发布于 2019-01-11 17:26:50
Groovy支持数组,就像在Java中一样,但是使用{}代替[]。用[]初始化数组
class ArrayTest {
@Test
public void demonstrateArray() {
int[] nums = [1, 2, 3];
}
}https://stackoverflow.com/questions/54151239
复制相似问题