Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- Matrix m1 = new Matrix(1,1);
- Matrix m2 = new Matrix(2,2);
- m1.getMatrix();
- m2.getMatrix();
- public class Matrix {
- int[][] m;
- public Matrix(int i, int j) {
- m = new int[i][j];
- }
- public void getMatrix() {
- for (int i = m.length; i <= 2 + m.length; i++) {
- for (int j = m.length; j <= 2 + m.length; j++) {
- System.out.print(i * j + " ");
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment