Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Matrix {
- private int x;
- private double[][] table;
- public Matrix(int x, double[][] xs) {
- table = new double[x][x];
- for (int i = 0; i < x; i++) {
- for (int j = 0; j < x; j++) {
- this.table[i][j] = xs[i][j];
- }
- }
- }
- public double elem(Matrix a) {
- return table[0][0];
- }
- }
- public class Test {
- public static void main(String[] args) {
- double[][] arr = new double[][] {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
- Matrix a = new Matrix(3, arr);
- double s;
- s = Matrix.elem(a);
- System.out.println(s);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement