Write a Java function that takes a string as input and returns the reverse of th
Write a Java function that takes a string as input and returns the reverse of the string. For example, if the input string is Hello, World!, the function should return…