Question: /** * * @param str: assume it contains at least one character * @return the last character in the String */ public char getLastChar(String str)
/** * * @param str: assume it contains at least one character * @return the last character in the String */ public char getLastChar(String str) { return 0; //'a' used as default value (to be completed) }
/** * * @param str: assume it contains at least one character * @return the String with the first character removed */ public String getWithoutFirstChar(String str) { return ""; //to be completed } /** * * @param str: assume it contains at least one character * @return the String with the last character removed */ public String getWithoutLastChar(String str) { return ""; //to be completed }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
