code snippets
code snippets
System.out.println(Arrays.toString(numbers));
O/P:
[1, 2, 3, 4, 5]
System.out.println(numbers[i]);
O/P:
Reason:This loop prints each element of the array by iterating through its
indices.
3) Import java.util.Arrays;
Int start = 0;
Numbers[start] = numbers[end];
Numbers[end] = temp;
Start++;
End--;
System.out.println(Arrays.toString(numbers));
O/P:
[5, 4, 3, 2, 1]
Reason: This code swaps the elements from the beginning and end of the
array, moving toward the center, thus reversing the array.
O/P:
Max value: 5
Reason:The loop checks each element and updates the `max` variable if
the current element is greater.
Int valueToFind = 3;
If (number == valueToFind) {
Found = true;
Break;
O/P: