[ERROR TEMPLATE] Java - NegativeArraySizeException
nedpals opened this issue · comments
Ned commented
Name | Type | Code | Language |
---|---|---|---|
NegativeArraySizeException | Runtime Exception | java.lang.NegativeArraySizeError | Java |
Description
An attempt to create an array with a negative size.
Sample Code
public class Main {
public static void main(String[] args) {
// Attempting to create an array with a negative size
int[] array = new int[-5];
System.out.println(array.length);
}
}
Sample Error Message
Exception in thread "main" java.lang.NegativeArraySizeException: -5
at Main.main(Main.java:4)
Implementation Checklist
- Implemented analysis
- Implemented explanation translation
- Implemented bug fix generation
- Add tests