Advertisement
sissou123

Untitled

Mar 31st, 2022
902
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. 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:
  2.  
  3. int[] arr;
  4.  
  5. Notice there is no size, since we didn't create the array yet.
  6.  
  7. arr = new int[10];
  8.  
  9. This will create a new array with the size of 10. We can check the size by printing the array's length:
  10.  
  11. System.out.println(arr.length);
  12. for more:https://gurl.pw/lJnW
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement