hello, guys i have a really stupid problem about characters and string; i dont know which to use. wacko.gif
iam bubble sorting for example a name::'( :?:
input:
dreamincode
output:
a c d d e e i m n o
why does my code in error? my compiler saids the ff:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The local variable characterArray may not have been initialized
The local variable characterArray may not have been initialized
The local variable characterArray may not have been initialized
at BubbleSort.main(BubbleSort.java:15)
i try my hardest but as if i try the more error i get.
i try to simplify the error like this short so it wouldn't be so complicated.
import java.util.Arrays;
import java.io.*;
public class BubbleSort {
/**
* @param args
*/
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader (new InputStreamReader(System.in));
char characterArray[];
System.out.print("Enter Name:\t");
Arrays.sort(characterArray);
for (int i = 0; i < characterArray.length; i++)
{
System.out.print(characterArray[i]);
System.out.print(", ");
}
}
}
can you please help me??
i really need your help.
Thnks so much