Declarer matric et affichier matric:
Exemble: import java.io.*;
class Matric {
static BufferedReader kbRead = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException
{
int m=getInt("Donner le nombre de la vecteur(enter,colone) =");
int n=getInt("Donner le nombre de la vecteur(enter,ligne) =");
int matric [][]=new int[n][m];/*declarer matric de la valeur enter */
/*charger la matric (valeur enter)*/
for(int i=0;i<matric.length;i++)
{
for (int j=0;j<matric[1].length;j++)
{
matric[i][j]=getInt("matric["+i+"]["+j+"]=");
}
}
System.out.println("//----*affichage le matric declarer*----//");
for (int i=0;i<matric.length;i++)
{
for (int j=0;j<matric[1].length;j++)
{
System.out.print(" "+matric[i][j]);
} System.out.println();
}
}
public static int getInt(String prompt) throws IOException
{
System.out.print(prompt + " ");
return Integer.parseInt(kbRead.readLine());
}
}