- Ensure each of the test cases in the class BasicArrayUtilsTest successfully passes upon completion of each of the method stubs in the class BasicArrayUtils.
String getFirstElement(String[])
String getSecondElement(String[])
String getLastElement(String[])
String getSecondToLastElement(String[])
- Description
- Given a string array,
stringArray
, return the first element of the array.
- Given a string array,
-
Sample Script
// Given String[] inputArray = {"The", "quick", "brown"}; // When String outcome = BasicArrayUtils.getFirstElement(inputArray); // Then System.out.println(outcome);
-
Sample Output
The
- Description
- Given a string array,
stringArray
, return the first element of the array.
- Given a string array,
-
Sample Script
// Given String[] inputArray = {"The", "quick", "brown"}; // When String outcome = BasicArrayUtils.getSecondElement(inputArray); // Then System.out.println(outcome);
-
Sample Output
quick
- Description
- Given a string array,
stringArray
, return the second element of the array.
- Given a string array,
-
Sample Script
// Given String[] inputArray = {"The", "quick", "brown"}; // When String outcome = BasicArrayUtils.getLastElement(inputArray); // Then System.out.println(outcome);
-
Sample Output
brown
- Description
- Given a string array,
stringArray
, return the second to last element of the array.
- Given a string array,
-
Sample Script
// Given String[] inputArray = {"The", "quick", "brown"}; // When String outcome = BasicArrayUtils.getSecondToLastElement(inputArray); // Then System.out.println(outcome);
-
Sample Output
quick