I can not understand what's wrong. The do\while with the setSize label setSize never executed, which is why the array is not initialized. The do loop should run at least once, right?

 int bound; int array[]; setSize: do { System.out.println("Π’Π²Π΅Π΄ΠΈΡ‚Π΅ ΠΆΠ΅Π»Π°Π΅ΠΌΡƒΡŽ Π΄Π»ΠΈΠ½Π½Ρƒ для Π½ΠΎΠ²ΠΎΠ³ΠΎ массива"); bound = getInt(); if (bound <= 0) { System.out.println("Π”Π»ΠΈΠ½Π½Π° массива Π½Π΅ ΠΌΠΎΠΆΠ΅Ρ‚ Π±Ρ‹Ρ‚ΡŒ ΠΎΡ‚Ρ€ΠΈΡ†Π°Ρ‚Π΅Π»ΡŒΠ½ΠΎΠΉ ΠΈΠ»ΠΈ Π½ΡƒΠ»Π΅Π²ΠΎΠΉ!"); continue setSize; } array = new int[bound]; } while (bound <= 0); System.out.println("Π‘ΠΎΠ·Π΄Π°Π½ массив array Π΄Π»ΠΈΠ½Π½ΠΎΠΉ " + array.length + " элСмСнтов!"); for (int i = 0; i < array.length; i++) { System.out.println("Π’Π²Π΅Π΄ΠΈΡ‚Π΅ число для элСмСнта массива с индСксом: " + i); array[i] = getInt(); } 
  • 3
    Is it exactly compiled? There at least you need to write instead of int array[]; following int array[] = {}; or change the logic. - KoVadim
  • and what an interesting setSize construction: do {} - does it compile? - Kirill Stoianov
  • one
    @KirillStoianov I understand that this is a label - Andrew Bystrov
  • one
    @SvyatoslavKaryuk 1) Solve the compilation problem as you indicated. 2) I understand that in this context, this label is meaningless, i.e. the program will retain its behavior if you remove the label and write just continue; instead of continue setSize; (if you had nested loops, for example, and you would need to jump from the inner one to the next iteration of the outer one, then yes) - StateItPrimitive
  • 3
    I see that the compilation still does not go (and javac and ecj are not compiled for me, because they cannot prove that array will always be initialized), and you run the old version, in which there is no loop. If you are sure that you are right, provide the entire class code, and indicate how you compile and run it. - zRrr

0