rendered paste bodyimport javax.swing.JOptionPane;
public class Table1{
static void fill(int[][] vt,int x){ //i sinartisi static void mou gemizei ton pinaka//
for(int i=0; i<vt.length; i++)
for(int j=0; j<vt[0].length; j++)
vt[i][j] = x;
}
static void print(int[][] vt){
for(int i=0; i<vt.length; i++)
for(int j=0; j<vt[0].length; j++){
System.out.print(vt[i][j]);
if(j<vt[0].length-1)
System.out.print(", ");
else
System.out.println();
}
}
public static void main(String args[]){
int[][] table;
int x,y,z;
String in;
in = JOptionPane.showInputDialog(null, "Give rows: "); //leei na dwsw grammes
x = Integer.parseInt(in);
in = JOptionPane.showInputDialog(null, "Give columns: "); //na dwsw steiles
y = Integer.parseInt(in);
in = JOptionPane.showInputDialog(null, "Give gemisma: "); //na dwsw stoixeia
z = Integer.parseInt(in);
table = new int[x][y];
System.out.println("Fill with this:");
fill(table,z);
print(table);
}
}