Posted by: khai_k_khai_k February 18, 2009
its again java problem
Login in to Rate this Post:     0       ?        
Please try to solve it by yourself first and if possible post your errors/exception rather than posting the question.

public class StringProblem {
    private String stringInstance;
    private char[] splittedString;

    public StringProblem(String initString) {
        stringInstance = new String(initString);
        splittedString = stringInstance.toCharArray();
    }

    public int length() {
        return splittedString.length;
    }

    public char charAt(int index) {
        return splittedString[index];
    }

    public static void main(String[] args) {
        StringProblem strProb = new StringProblem("NEPAL");
        
        for (int i = strProb.length() - 1; i >= 0; i--) {
            System.out.print(strProb.charAt(i) + " ");
        }
    }
}
Read Full Discussion Thread for this article