0
/ 20
Create a method that returns the third character from the String word
. Be sure to use a try catch block and use the appropriate exception...
Create a method that returns the third character from the String word
. Be sure to use a try catch block and use the appropriate exception to deal with indexes out of a String’s bound: StringIndexOutOfBoundsException
. Return the character 'x' (lowercase) when this exception is caught. Do not use if statements and do not use the general exception handler Exception.
Examples:
thirdLetter("test") -> 's'
Your feedback will appear here when you check your answer.