I need help to write a parameterless, void and recursive method used to reverse a string of character. Can anybody help me with the last part?
This is the code I been able to write so far :
import java.util.*; public class Labex78 { public static String put = put; static boolean check= true; public static void main(String[] args) { reverse(); } public static void reverse() { Scanner kbd= new Scanner(System.in); if(check==true){ System.out.println("Enter 5 characters"); put = kbd.nextLine(); check= false;} int len = put.length(); if(len<=1) { System.out.print(put); } else { String rev =""; rev += put.charAt(put.length()-1); put= put.substring(0,put.length()-1); reverse(); System.out.println(" Read backwards, character becomes "+ rev); } } }