N
N
nano_e_t_42016-01-17 01:03:53
Java
nano_e_t_4, 2016-01-17 01:03:53

java screen output?

Hello everyone
Plz tell me how to bypass variables in a loop?
int a1 = 5;
int a2 = 6;
int a3 = 7;
for (int i = 1; i <=3; i++)
System.out.println(a[i]);
in this case, an Uncompilable source code error is thrown. In general, it is understandable (although not very good, but this is a matter for further study)
Thank you

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Peter, 2016-01-17
@nano_e_t_4

This problem has no solution.
If these were class variables, or class properties, then it would be possible through reflection.

N
Neonoviiwolf, 2016-01-17
@Neonoviiwolf

Yes, there is a gap of the whole semester in sight. Open the chapter "arrays" and read

A
Antonzm, 2016-01-19
@Antonzm

int[] a = new int[]{5,6,7};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question