subject

Debug the code in the main method of this class, which is intended to initialize an array named arr to hold 3 ints, fill this with 3 inputs from the user, then print the contents of the array in order followed by the sum. Here's the code that needs to be fixed:

import java. util. Scanner;

public class U6_L1_Activity_One{
public static void main(String[] args){
Scanner scan = new Scanner(System. in);
int[] arr = new int(3);
arr[1] = scan. nextInt();
arr[2] = scan. nextInt();
arr[3] = scan. nextInt;
System. out. println("Contents: " + arr{1} + " " + arr{2} + " " + arr{3});
System. out. println("Sum: " + arr[1] + arr[2] + arr[3]);
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 13:00
Donnie does not have powerpoint. which method would be best for elana to save and share her presentation as is? a pdf a doc an rtf a ppt
Answers: 3
question
Computers and Technology, 25.06.2019 06:10
In your pest busters game, how does player 2 move the ship_2 object? a pressing the w and s keys b. pressing the up arrow and down arrow keys c. moving the mouse from side to side d. moving the mouse up and down select the best answer from the choices provided
Answers: 3
question
Computers and Technology, 25.06.2019 08:00
The bus width and bus speed together determine the bus's or bandwidth; that is, the amount of data that can be transferred via the bus in a given period of time.
Answers: 1
question
Computers and Technology, 25.06.2019 11:00
What components of nonverbal communication are depicted in these photographs? a. clothing b. artifacts c. emblems d. masking
Answers: 1
You know the right answer?
Debug the code in the main method of this class, which is intended to initialize an array named arr...
Questions
question
Mathematics, 14.05.2021 20:20
question
Mathematics, 14.05.2021 20:20
question
Mathematics, 14.05.2021 20:20
question
Biology, 14.05.2021 20:20
question
English, 14.05.2021 20:20
Questions on the website: 13722367