Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Arrays in Java are also objects. They need to be declared and then created. In order to declare a variable that will hold an array of integers, we use the following syntax:
- int[] arr;
- Notice there is no size, since we didn't create the array yet.
- arr = new int[10];
- This will create a new array with the size of 10. We can check the size by printing the array's length:
- System.out.println(arr.length);
- for more:https://gurl.pw/lJnW
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement