for a practice exercise I have two constructors to create a table, in one of them I receive as arguments a matrix with the data and a vector with the headers, I want to insert the headers in the matrix and then send the edited matrix to the final constructor, but I was informed that I can not put logic in the constructor, so I took the process apart in a method which edits the matrix and returns it to send it to the final constructor, but I still get an error, I do not know what is wrong and What can you recommend me to do?
public Tabla(String [][]matriz){
filas=matriz.length; //devuelve cantidad de filas en la matriz
columnas=matriz[0].length; //devuelve cantidad de datos enesa fila
m=new String[filas][columnas];
m=matriz;
m2=new String[filas][columnas];
m2=matriz; //uso m2 para cuando se necesite girar la tabla
bordeH="";
bordeV="|";
tabla="";
anchoColumna=new int[columnas]; //dimensiona segun cantidad decolumnas
anchoFila=new int[filas];
anchoTabla=0;
}
public Tabla(String [][] matriz, String[]encabezado){
Tabla(unirMatriz(matriz,encabezado));
}