Atem85

JJ

Sep 4th, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. public class Main {
  2.     public static void main(String[] args) {
  3.         Matrix m1  = new Matrix(1,1);
  4.         Matrix m2 = new Matrix(2,2);
  5.         m1.getMatrix();
  6.         m2.getMatrix();
  7.  
  8. public class Matrix {
  9.     int[][] m;
  10.  
  11.     public Matrix(int i, int j) {
  12.         m = new int[i][j];
  13.     }
  14.  
  15.     public void getMatrix() {
  16.         for (int i = m.length; i <= 2 + m.length; i++) {
  17.             for (int j = m.length; j <= 2 + m.length; j++) {
  18.                 System.out.print(i * j + " ");
  19.             }
  20.             System.out.println();
  21.         }
  22.  
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment