Making an array list
I am trying to make a program where I from my keyboard write a textstring into a textbox .. for exampel Norway.
I want the java program to make an array with the characters ... (N O R W A Y) also in reversemode (Y A W R O N)
Is this possible?
I'm not very talented in java-programming - So please help me :p
[334 byte] By [
Thomas78a] at [2007-10-2 5:47:24]

You don't need an array. You can just use a StringBuffer.
public static String reverse(String s) {
StringBuffer sb = new StringBuffer(s.length());
for(int j=s.length()-1;j>=0;j--)
s.append(s.charAt(j));
return sb.toString();
}
Ok ... I tried alot but I didn't get it working.
The following sourcecode is my sollution to from string to array.
But my problem is how to get the output in reversemode?
and also how to capitalize it so every charecter a will be B ...
--
import javax.swing.JOptionPane;
class napa3
{
public static void main(String[] args)
{
String sInputString,sOutputArray[];
sInputString = (JOptionPane.showInputDialog(null,"Skriv inn en String","Input",JOptionPane.OK_CANCEL_OPTION));
sOutputArray = new String[sInputString.length()];
for (int i = 0; i < sInputString.length(); i++) {
sOutputArray = sInputString.substring(i,i+1);
System.out.println("[DEBUG] " + sInputString.substring(i,i+1));
}
}
}