Results 1 to 2 of 2
Thread: Error while printing out arrays
- 05-03-2012, 12:27 AM #1
Member
- Join Date
- Apr 2012
- Posts
- 8
- Rep Power
- 0
Error while printing out arrays
Basically when I'm trying to print out the array I get the [@edf56s or whatever numbers and not the actually word in the array. Yes I have tried Arrays.toString method. I've done Arrays.toString(list[i]) but I get a WordProcessing.java:133: error: no suitable method found for toString(Word). I have tried Arrays.toString(list) and it not only didn't print out the words but it print out the [@ef56s codes instead.Java Code:public static void printWords(Scanner outFile, Word[] list) throws FileNotFoundException{ int i = 0; System.out.println("printing words"); PrintStream output = new PrintStream(new File("outfile")); output.println("words in \nsorted order \t number of \n occurences"); output.println("----------------------------------"); while (i < list.length && list[i] != null) { output.println(list[i] + "\t" + list[i].getCount() + "\n"); //Right here is the trouble i++; } }
- 05-03-2012, 12:34 AM #2
Member
- Join Date
- Apr 2012
- Posts
- 8
- Rep Power
- 0
Similar Threads
-
Printing multiple arrays in 1 dialog box
By turbopenguin in forum New To JavaReplies: 9Last Post: 04-19-2012, 08:18 AM -
Printing 2D Array Error
By noble in forum New To JavaReplies: 9Last Post: 11-09-2010, 05:31 PM -
Printing Two Dimensional Arrays with for loops
By mcnam4119 in forum JCreatorReplies: 3Last Post: 10-06-2010, 05:27 AM -
Printing value of boolean arrays
By myst in forum New To JavaReplies: 7Last Post: 06-02-2010, 08:44 PM -
[SOLVED] Help with arrays, printing highest and lowest value of the array.
By Sophiie in forum New To JavaReplies: 21Last Post: 11-05-2008, 02:31 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks