Question: help with this code in java please Given a string return the first character in the string if it contains more than 4 characters, and
help with this code in java please

Given a string return the first character in the string if it contains more than 4 characters, and the last character otherwise. firstOrLastChar("kwk") firstOrLastChar("gals") firstOrLastChar("uocrws") For example: Test 'k' 's' 'u' System.out.println(first0rLastChar("xdylp")); x Answer: (penalty regime: 0, 10, 20, 50, ... %) Result Reset answer 1 public String 2 // TODO your code goes here 3} firstOrLastChar(String str) {
Step by Step Solution
There are 3 Steps involved in it
Heres the completed Java code for the firstOrLastChar method based on the provided requirem... View full answer
Get step-by-step solutions from verified subject matter experts
