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 app7;
- /**
- *
- * @author Admin
- */
- public class App7 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- int[] arr = {1, 2, 3};
- System.out.println("arr[0]=" + arr[0]);
- System.out.println("arr[1]=" + arr[1]);
- System.out.println("arr[2]=" + arr[2]);
- // необходимо использовать св-во length
- int i = 3;
- if(i<arr.length){
- // выход за пределы массива
- System.out.println("arr[3]=" + arr[i]);
- }
- System.out.println("OK!!!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement