Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Array {
- private int row, column;
- public int getColumn() {
- return column;
- }
- public void setColumn(int column) {
- this.column = column;
- }
- public int getRow() {
- return row;
- }
- public void setRow(int row) {
- this.row = row;
- }
- private int[][] matrix = new int [row] [column];
- public int[][] getMatrix() {
- return matrix;
- }
- public void setMatrix(int[][] matrix) {
- this.matrix = matrix;
- }
- void inputMatrix()
- {
- Scanner sc = new Scanner (System.in);
- for(int i = 0; i<row;i++)
- {
- for(int j=0;j<column;j++)
- {
- matrix[i][j] = sc.nextInt();
- }
- }
- }
- void outputMatrix()
- {
- for(int i=0; i <row ; i++)
- {
- for(int j=0; j<column;j++)
- {
- System.out.print(matrix[i][j]);
- }
- }
- }
- void maxElement()
- {
- int max = 0;
- for(int i=0; i<row;i++)
- {
- for(int j=0; j<column; j++)
- {
- if(max<matrix[i][j])
- {
- max = matrix[i][j];
- }
- }
- }
- System.out.println("Maximum is: " + max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement