Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Handler {
- Mas mas = new Mas();
- public void doSmthArray() {
- int sum = 0;
- if (mas.getMassiv().length > 4) throw new MyArraySizeException();
- for (int i = 0; i < mas.getMassiv().length; i++) {
- for (int j = 0; j < mas.getMassiv()[i].length; j++) {
- try {
- sum = sum + Integer.parseInt(mas.getMassiv()[i][j]);
- } catch (NumberFormatException e) {
- System.out.println();
- throw new MyArrayDataException();
- }
- }
- }
- }
- }
- public class MainClass {
- public static void main(String[] args) {
- Handler handler = new Handler();
- try {
- handler.doSmthArray();
- }catch (MyArraySizeException e){
- System.out.println("превышен допустимый размер массива");
- }catch (MyArrayDataException exc){
- }
- }
- }
- Console.log('i = ' + i + ' j = ' + j);
Add Comment
Please, Sign In to add comment