public class CreateNewArray {
public static int[] createArray() {
int numbers[] = new int[5];
for (int i = 0; i < numbers.length; i++) {
numbers[i] = i + 1;
}return numbers;
}
}
The code does not work, please, help me to fix it.
Illegal modifier for the local class CreateNewArray; only abstract or final is permitted.
Well just remove the public.
class CreateNewArray {
public static int[] createArray() {
int numbers[] = new int[5];
for (int i = 0; i < numbers.length; i++) {
numbers[i] = i + 1;
}return numbers;
}
}
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.