acceso variables
Publicado por Mary (31 intervenciones) el 25/11/2006 23:02:39
hola
como acceso a las variables de otra clase?
tengo esto:
Public class Datos {
int valor, marca;
}
public class Matrices implements XMatriz {
public Datos mat[][];
public int f;
public int c;
.....
public XMatriz metodo1();
public XMatriz metodo2(f,c);
....
}
desde otra clase trato se accceder a la matriz mat asi
Matrices.mat[i][j]=9 pero me sale el error "non-static variable cannot be referenced from a static context" si lo hago asi tambien Matrices.mat[i][j].valor=9
si coloco XMatriz matriz = new Matrices();
matriz.mat[i][j].valor=9; el error es "Array required, but xmatriz.datos found"
AYUDA POR FAVOR COMO HAGO?
GRACIAS BUEN DIA :)
como acceso a las variables de otra clase?
tengo esto:
Public class Datos {
int valor, marca;
}
public class Matrices implements XMatriz {
public Datos mat[][];
public int f;
public int c;
.....
public XMatriz metodo1();
public XMatriz metodo2(f,c);
....
}
desde otra clase trato se accceder a la matriz mat asi
Matrices.mat[i][j]=9 pero me sale el error "non-static variable cannot be referenced from a static context" si lo hago asi tambien Matrices.mat[i][j].valor=9
si coloco XMatriz matriz = new Matrices();
matriz.mat[i][j].valor=9; el error es "Array required, but xmatriz.datos found"
AYUDA POR FAVOR COMO HAGO?
GRACIAS BUEN DIA :)
Valora esta pregunta


0