Description
A common array programming exercise for students reviewing arrays in Java - or practicing for the AP Computer Science exam! Includes fully coded and tested solution!
Write a method that takes in an array of integers and returns true if each element in the array is greater than the last, and false otherwise. Return false if the array has zero elements.
int[] arrInc = {1, 2, 3, 4, 5, 6, 7};
int[] arrNotInc = {2, 4, 1, 9, 3, 5};
System.out.println(arrayIncreasing(arrInc));
>> true
System.out.println(arrayIncreasing(arrNotInc));
>> false
AP Computer Science A - Problem 3: Array Practice! Increasing numbers in Java
Highlights
Description
A common array programming exercise for students reviewing arrays in Java - or practicing for the AP Computer Science exam! Includes fully coded and tested solution!
Write a method that takes in an array of integers and returns true if each element in the array is greater than the last, and false otherwise. Return false if the array has zero elements.
int[] arrInc = {1, 2, 3, 4, 5, 6, 7};
int[] arrNotInc = {2, 4, 1, 9, 3, 5};
System.out.println(arrayIncreasing(arrInc));
>> true
System.out.println(arrayIncreasing(arrNotInc));
>> false



