Search⌘ K

Practice Challenges for Fun

Explore practical Java array challenges to enhance your understanding of array manipulation. Learn to compute averages, reverse arrays in place and by creating new arrays, and count words in arrays. This lesson helps you solidify foundational skills necessary for handling arrays confidently in Java.

Quiz 1

Attempt the following quiz questions:

Technical Quiz
1.

Which of the following Java statements will declare and allocate an array capable of containing at most 20 integers?

A.
int[] numbers = new int[20];
B.
int[] numbers = new int(20);
C.
int[] numbers = new int[19];
D.
int[] numbers = new int(19);

1 / 4

Quiz 2

Attempt the following quiz questions:

1.

Write Java statements to display the contents of the array:

String[] daysOfWeek = {"Sunday", "Monday", "Tuesday", "Wednesday",
                       "Thursday", "Friday", "Saturday"};
Show Answer
1 / 6
Java
public class QuizAnswers
{
public static void main( String args[] )
{
String[] daysOfWeek = {"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"};
// Write your answer to Q1 here:
// Write your answer to Q2 here:
int[] numbers = {1, 3, 5, 7, 9};
// Write your answer to Q3 here:
} // End main
} // End QuizAnswers

Challenge

...