Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/06/2013, 09:22
la_angita
 
Fecha de Ingreso: septiembre-2012
Mensajes: 2
Antigüedad: 11 años, 7 meses
Puntos: 0
variable no reconocida

Hola, tengo un ejercicio que resolver (para mañana :() y tengo un problema. Les escribo mi código:

Código Java:
Ver original
  1. public class FindHiddenWords {
  2.  
  3.   public static final char UNKNOWN = '?';
  4.  
  5.   public FindHiddenWords(int targetWidth, int targetHeight,
  6.       String[] wordsToFind) {
  7.       int matrixWidth = targetWidth;
  8.       int matrixHeight = targetHeight;
  9.   }
  10.  
  11. void initializeMatrix() {
  12.    
  13.       char [][] matrix;
  14.          if (matrixWidth == 0 || matrixHeight == 0){
  15.              matrix [1][1] = UNKNOWN;
  16.          }
  17.          else {
  18.          matrix = new char[matrixWidth][matrixHeight];
  19.          for (int i=1; i<matrixHeight){
  20.              for (int j=1; i< matrixWidth){
  21.                  matrix [i][j] = UNKNOWN;
  22.                  j++;}
  23.              }
  24.              i++;
  25.          }
  26.       }
Bueno, la cosa es que el método FindHiddenWords debería recordar los parámetros de ancho y alto de la matrix. Por eso los declaré como int = matrixWidth y int=matrixHeight. Pero después cuando necesito usarlos en el siguiente método (initializeMatrix) no me deja. Eclipse me dice que tanto matrixWidth como matrixHeight no existen.
¿qué estoy haciendo mal? Gracias por su ayuda!
Angi.

Última edición por razpeitia; 20/06/2013 a las 10:38