Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ipalpzapocet;
- import java.util.Arrays;
- /**
- *
- * @author Wanis_
- */
- public class Matice<T> {
- private Object[][] matice;
- public Matice(int m, int n) {
- matice = new Object[m][n];
- }
- public T vratPrvek(int m, int n){
- try {
- return (T) matice[m][n];
- }
- catch (Exception e) {
- throw e;
- }
- }
- public void vlozPrvek(T prvek, int m, int n){
- try {
- matice[m][n] = prvek;
- }
- catch (Exception e) {
- throw e;
- }
- }
- @Override
- public String toString() {
- return Arrays.deepToString(matice);
- }
- public void vypisMatici(){
- for (int i = 0; i < matice.length; i++) {
- for (int j = 0; j < matice[i].length; j++) {
- System.out.printf("%6d", matice[i][j]);
- }
- System.out.println("");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement