Created
June 10, 2018 14:28
-
-
Save bijancot/d6d79de3ce341a7466c87cef7adc8523 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package pkg00_project; | |
import java.util.Scanner; | |
/** | |
* | |
* @author bijan | |
*/ | |
public class NewClass { | |
private static String balik(String kata) { | |
int y = kata.length(); | |
if ((kata == null || y <= 1)) { | |
return kata; | |
} | |
return balik(kata.substring(1)) + kata.charAt(0); | |
} | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
System.out.print("masukkan angka/huruf : "); | |
String str = input.nextLine(); | |
System.out.println(balik(str)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment