Re: weird runtime error




<asbjornh@xxxxxxxxx> wrote in message
news:1175018890.600066.180410@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi. I'm currently taking a beginners java-programming class at the
University in Bergen, Norway. This week we got an assignment that we
have to do before friday. If I don't pass, they won't let me take the
final exam... :(
So we're making a sudoku game, and the teacher gave us a bunch of
classes. We're supposed to "fill in the blanks". It all went
reasonably well, until I tried to print out the sudoku table, and i
got this really weird output. Instead of numbers, I got this:
Region@112f614 (Region is the class of which the cells in the table
are objects - I think...) Does anyone know what causes this? If
needed, I could post the code, but it is a lot of code, and all the
comments and the names are all in norwegian. But if you need to see
the code in order to help me, please just ask.

add a method to your Region class:
public String toString()
{
return "however you want the output to look";
}
the "however you want the output to look" bit is likely to be something like
getValue() or getNumber, whatver your method is called in the Region class
that gets the output you actually want to see


.



Relevant Pages

  • weird runtime error
    ... I'm currently taking a beginners java-programming class at the ... University in Bergen, Norway. ... This week we got an assignment that we ... So we're making a sudoku game, and the teacher gave us a bunch of ...
    (comp.lang.java.help)
  • Re: weird runtime error
    ... So we're making a sudoku game, and the teacher gave us a bunch of ... Region@112f614 (Region is the class of which the cells in the table ... System.out.printlnis to invoke the .toString() method on any objects ... Another solution would be to modify the Region class so that it ...
    (comp.lang.java.help)