Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package day7_exceptions;
- import java.util.Scanner;
- /**
- *
- * @author sao_7
- */
- public class Day7_exceptions {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- //examples();
- exercise(); // kods nestraadaa
- }
- public static void examples(){
- int[] arr = new int[5];
- try{
- for (int i = 0; i < 6; i++) {
- arr[i] = i+1;
- System.out.println(arr[i]);
- }
- }catch(Exception ex){
- System.out.println("nokeram");
- }
- System.out.println("peec kluudas");
- }
- //Uztaisitt metodi, kur cilveks ievada masiva garumu
- //ar ciklu aizpildam masivu ar vertibam (integer, vai string)
- //tad cilveks ievada kuru elementu mes mainam
- //tad izvadam masivu
- public static void exercise(int[] arr){
- Scanner sc = new Scanner(System.in);
- int[] i = new int[10];
- try{
- for (int j = 0; j < 10; j++) {
- i[j] = j+1;
- System.out.println(i[j]);
- }
- }catch(Exception ex){
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement