R
R
Rishat Sultanov2016-10-04 10:52:43
Java
Rishat Sultanov, 2016-10-04 10:52:43

How to add an integer to an array?

Good afternoon.
Where am I wrong?
9BB1249e.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NoMoneyException, 2016-10-04
@rishatss

an array is not a dynamic structure. you need to set its size at the beginning

int[] x = new int[5];
x[0] = 1;

if you want it like you do it like this:
int[] x = new int[]{n};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question