Java Programming

Given a string return the first character in the string if it contains more than 4 characters, and the last character otherwise. firstOrLastChar(“kwk”)- k firstOrLastChar(“gals”) → ‘s’ firstOrLastCharCuocrws”)-‘u’ For example: Test Result System.out.println(firstorLastchar(“qug”))g Show transcribed image text
Expert Answer
An answer will be send to you shortly. . . . .