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

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

1 Expert Approved Answer
Step: 1 Unlock

Heres the completed Java code for the firstOrLastChar method based on the provided requirem... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!