Created
November 26, 2012 14:43
-
-
Save yusufsyaifudin/4148564 to your computer and use it in GitHub Desktop.
Membalikkan karakter pada sebuah string
This file contains hidden or 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 template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package reversestring; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
/** | |
* | |
* @author YusufSyaifudin | |
*/ | |
public class Reversestring { | |
/** | |
* @param args the command line arguments | |
*/ | |
public static void main(String[] args) { | |
// TODO code application logic here | |
BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); | |
try { | |
String str = input.readLine(); | |
System.out.println("String asli : " + str); | |
// | |
str = new StringBuffer(str).reverse().toString(); | |
System.out.println("String yang dibalik : " + str); | |
} catch (IOException ex) { | |
System.out.print(ex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment