public class working {
public static String str = "123zASdcvb/;[";
public static void main(String[] args){
System.out.println("!!!"+new LetterInventory(str));
}
public static class LetterInventory {
public char[] arr;
public LetterInventory(String str){
//Strips our string of all non alphabetic garbage
//and assigns it. This regex removes all non a-z
//without regard for case of alphabet (?!).
this.arr = str.replaceAll("[^a-z]", "").toLowerCase().toCharArray();
Arrays.sort(this.arr); //I want to have it sorted to make my life easier.
System.out.printf("Our freshly sorted LI is : %s\n",this.toString());
}
//Simple enough.
public String toString() {
return this.arr.toString();
}
}
}
output:
Our freshly sorted LI is : [C@6d69c9a2
!!![C@6d69c9a2
What is going wrong here? I walked through my debugger and my array does exactly what I want, it is created, cleaned, and sorted just fine. But everytime I try to print my char[].toString() it comes out screwey. Why so?