X465: Review - First Two

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

Given a string, return the string made of its first two chars, so the string "Hello" yields "He". If the string is shorter than length 2, return whatever there is, so "X" yields "X", and the empty string "" yields the empty string "". Note that str.length() returns the length of a string.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.