Question: Write java code for the following questions: 1. Create an ArrayList name it myArray that represents following numbers. {26, 10, 3, 0, 7, 9} 2.
Write java code for the following questions:
1. Create an ArrayList name it myArray that represents following numbers. {26, 10, 3, 0, 7, 9}
2. Compute the summation of even numbers and odd numbers from myNums and name them evenSum and oddSum. Hint1: you can use % to check if a number is even. Hint2: you can use enhanced for-loop.
3. Add evenSum and oddSum in myArray.
4. Sort the myArray and display to output.
5. Use for loop to replace even numbers with 0 (zero) and odds with 1.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
