P
P
pshevnin2021-04-30 00:03:46
Java
pshevnin, 2021-04-30 00:03:46

What is the correct way to create an ArrayList array?

Hello, in the program I use an array of object sheets. But when I try to interact with ArrayLists, I get a NullPointerException error. Could someone suggest how to solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2021-04-30
@pshevnin

You create an array of lists of size colors. The array is initially filled with nulls. Therefore, when you take a certain element of this array, and call a method on it, an NPE occurs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question