Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. public class Matrix {
  2.     private int x;
  3.     private double[][] table;
  4.     public Matrix(int x, double[][] xs) {
  5.         table = new double[x][x];
  6.         for (int i = 0; i < x; i++) {
  7.             for (int j = 0; j < x; j++) {
  8.                 this.table[i][j] = xs[i][j];
  9.             }
  10.         }
  11.     }
  12.     public double elem(Matrix a) {
  13.         return table[0][0];
  14.     }
  15. }
  16.  
  17.  
  18. public class Test {
  19.     public static void main(String[] args) {
  20.         double[][] arr = new double[][] {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
  21.         Matrix a = new Matrix(3, arr);
  22.         double s;
  23.         s = Matrix.elem(a);
  24.         System.out.println(s);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement