Answer the question
In order to leave comments, you need to log in
Creating, copying and displaying an array with the private modifier?
I welcome all Khabrovites.
The crux of the matter is this: there is some game, during the execution of which several players enter random values in turn. Only 10 attempts each. It is necessary to store all the entered numbers in an array, for each player his own. Required with private access.
Here is my array private int[] numbers = new int[10]
Its setter is public void setNumbers(int numbers) {};
What's the catch: I understand the essence, but like a blind kitten, I can't figure out how to approach implementation.
It seems that there is an array, its setter, but I don’t understand how to cram the numbers entered by the player into the array. 11 hours in front of the monitor and deaf ...
Answer the question
In order to leave comments, you need to log in
at first I started writing a solution, but I didn’t understand something at
all that setNumbers is needed here, what is it? it takes one number, and there are 10 of them in the array. What is networking here at all?
I understand the pointjudging by the curve of the wording, no, not really,
It is better to use not an array, but a List.
You, apparently, do not need a setter, but a method that will add a value to an array (or sheet).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question