Computers and Technology

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]);
}
}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 15:00, victordhernandez01
Jake really works well with numbers and is skilled with computers but doesn't work well with others. which of the jobs discussed in this unit might be best for jake? why?
Answers: 3
image
Computers and Technology, 24.06.2019 16:30, magalya01
Which program can damage your computer?
Answers: 1
image
Computers and Technology, 24.06.2019 18:30, millie54
How does the use of e-mail benefit business communications? it can be sent at any time. it is faster than regular mail. it improves writing skills. it is less expensive than using a courier. it reduces the need for proofreading.
Answers: 1
image
Computers and Technology, 25.06.2019 00:30, jennynmike03
Which of these serves as a bridge between the programming team and the audio team?
Answers: 2
Do you know the correct answer?
Debug the code in the main method of this class, which is intended to initialize an array named arr...

Questions in other subjects:

Konu
Mathematics, 03.12.2020 22:20
Konu
Arts, 03.12.2020 22:20