Results 1 to 2 of 2
  1. #1
    cjgarcia is offline Member
    Join Date
    Apr 2012
    Posts
    8
    Rep Power
    0

    Default Error while printing out arrays

    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++;
    		}		
    	}
    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.

  2. #2
    cjgarcia is offline Member
    Join Date
    Apr 2012
    Posts
    8
    Rep Power
    0

    Default Re: Error while printing out arrays

    Never Mind figure it out

Similar Threads

  1. Printing multiple arrays in 1 dialog box
    By turbopenguin in forum New To Java
    Replies: 9
    Last Post: 04-19-2012, 08:18 AM
  2. Printing 2D Array Error
    By noble in forum New To Java
    Replies: 9
    Last Post: 11-09-2010, 05:31 PM
  3. Printing Two Dimensional Arrays with for loops
    By mcnam4119 in forum JCreator
    Replies: 3
    Last Post: 10-06-2010, 05:27 AM
  4. Printing value of boolean arrays
    By myst in forum New To Java
    Replies: 7
    Last Post: 06-02-2010, 08:44 PM
  5. Replies: 21
    Last Post: 11-05-2008, 02:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •