uni

University stuff
git clone git://git.christosmarg.xyz/uni-assignments.git
Log | Files | Refs | README | LICENSE

RecursiveRev.java (395B)


      1 public class RecursiveRev {
      2         public static String strrev(String s) {
      3                 if (s.isEmpty())
      4                         return s;
      5                 else
      6                         return strrev(s.substring(1)) + s.charAt(0);
      7         }
      8 
      9         public static void main(String[] args) {
     10                 String s = "Hello world";
     11 
     12                 System.out.println(strrev(s));
     13         }
     14 }