Question: Java import java.util.Scanner, public class Prelab public static void main(String[] args) { var array = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9,
![Java import java.util.Scanner, public class Prelab public static void main(String[] args)](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f2ff467679c_09466f2ff4614a14.jpg)
Java
import java.util.Scanner, public class Prelab public static void main(String[] args) { var array = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10); var array2 = new int[]{10, 9, 8, 7, 6, 5, 4, 3, 2, 1); // 1. Iterate through the arrays, summing their corresponding values together and then printing the result. 1 The output should be "ll li lil1111111111111 // 2. Read a line of input using 'sc". The line should be five space-separated integers. Then, print the sum of the integers. var sc = new Scanner(System.in); // 3. Using a switch expression, assign the value of a variable "xbased on these cases: -If flag is 'A', set 'x' to '1' / If flag is 'B', set to 2 11 - If flag is "C", set x' to 3 // - otherwise, throw some Exception; // % Then, print x char flag 'A'; // 4. Fill up the matrix mat with the following values using a for loop: 0, 2, 4, 6, 8 var mat = new int[5]; )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
