X501: Review - The End

[Based on an exercise at https://codeworkout.cs.vt.edu/]

Write a function in Java that implements the following logic: Given a string, return a string of length 1 from its front, unless front is false, in which case return a string of length 1 from its back. The string will be non-empty.

Examples:

theEnd("Hello",true) -> "H"

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.