Static method cannot be referenced from a non static context: List<String>
The code you have posted does compile. To call it you will need to use the class name like this (because the method is static
):
String[] stringArray = test_clonestring.generateStringArray(5);
This will not compile:
String[] stringArray = new test_clonestring().generateStringArray(5);