역출력 콘솔에서 입력한 문자열

858 단어 String역순

package test1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *              
 * @author Nihaorz
 *
 */
public class ReversePrint {
	public static void main(String[] args) {
		String a = "", b = "", c = "";
		System.out.println("      :");
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			if((b = br.readLine()) != null) {
				a = a + b;
			}
			for(int i = a.length() - 1; i >= 0; i--) {
				c = c + a.substring(i, i + 1);
			}
			System.out.println(c);
		} catch (IOException e) {
			System.out.println(e.getMessage());
		}
		
	}
}


좋은 웹페이지 즐겨찾기