Question: Question 3 (1 point)Saved The goal of the code below is to calculate and print the sum of the numbers from 1 to 10. Which
Question 3 (1 point)Saved The goal of the code below is to calculate and print the sum of the numbers from 1 to 10. Which of the following are errors in the code? (check all that apply.) int i:0; while (i10) int sum sum+i System.out.println("sum sum The loop will never terminate because i never changes The variable i is declared outside the loop but used inside it. A variable cannot be defined inside a code block The variable "sum is out of scope in the print statement Question 5 (1 point) Saved Which is a good description of the error in the code below? int a 3 Curly braces must be associated with an if statement or other formal construct. a is defined inside the block, so it is out of scope for the statement "a++:" . ++ has no meaning in Java. A variable cannot be defined inside a code block. Question 6 (1 point) Saved What code will print all the elements of array b on separate lines? for (int i-0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
