Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/01/2010, 17:22
GRATER2
 
Fecha de Ingreso: enero-2010
Mensajes: 2
Antigüedad: 14 años, 3 meses
Puntos: 0
Ayuda con matrices en java

hola pues mi proble ma es el siguiente me pidieron un programa que lea 2 matrices de 2 archivos diferentes, que las divida e imprima el resultado en un archivo
esto es lo que tengo:
import javax.swing.*;
import java.io.*;

public class matrizA
{
static String line = "";
static int col=0,fila=0;
static int ma[][];

public static void leer ()throws IOException
{

BufferedReader reader= new BufferedReader(new FileReader(args[0]));
String linea= reader.readLine();
while(linea!=null) {
System.out.println(linea);
linea= reader.readLine(); }

public static void imprimir () throws IOException
{
JFileChooser archivoD = new JFileChooser();
archivoD.setDialogTitle("Nombre del archivo a Escribir");
archivoD.showDialog(null, "SaveArchivo");

File archivoG = archivoD.getSelectedFile();

FileWriter fw = new FileWriter(archivoG);
PrintWriter pw = new PrintWriter(fw);
for(int f=0;f<fila;f++)
{
pw.println("");
for(int c=0;c<col;c++)
{
pw.print(ma[f][c]+", ");
}
}
fw.close();
}
public static void main (String[] args) throws IOException
{
leer();
ma=new int [fila][col];
imprimir();
}
}
esque la verdad yo de archivos no c gran cosa muchas gracias de antemano

Última edición por GRATER2; 17/01/2010 a las 18:14