1.Create a class called Lab6 with one private field called lab that is a primiti
ID: 3674541 • Letter: 1
Question
1.Create a class called Lab6 with one private field called lab that is a primitive array of 100 integers.
2.Create a constructor that populates the primitive array lab with even numbers beginning at 2.
3.Create a method called printReverse that prints the contents of the primitive array lab to a terminal window in reverse order.
4.Create a method called printArray that uses a while loop to print the contents of the primitive array lab to a terminal window.
5.Create a method called sumArray that uses a for-loop to return the sum of all the elements in the primitive array lab.
Explanation / Answer
Please find the required code below :
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.