|
|
Juma Al Masoudi answered |
|
|
Saeed Al Jabri answered |
|
|
Amira Al Badi answered |
|
|
Salem Al Balushi answered |
|
|
Mubarak Al Khalifa answered |
|
|
Samira Abdullah Al Rahim answered |
|
|
Sonal Yadav answered |
|
|
Huda Sameer Al Mazroui answered |
|
|
Ayman Al Daheri answered |
|
|
Sonal Yadav answered |
|
|
Shaikha Talal Al Hashimi answered |
|
|
Safiya Omar Al Haddad answered |
int[] arr = new int[5];int keyword.[] after "arr".new keyword followed by the array type and the desired size of the array in square brackets. In this example, we use new int[5] to create an array of integers with a size of 5.int[] arr = new int[5];int arr[] = new int[5];) is also syntactically correct in Java, but it is generally recommended to use option 'B' for better readability and consistency.int arr[5] = new int[];) is incorrect because the size of the array should be specified before the array name, not inside the square brackets.int[] arr = new int[]{1, 2, 3, 4, 5};) is a valid way to declare and initialize an array with specific values. However, it is not the same as initializing an array with a specific size, as in the given question.|
|
Sonal Yadav answered |
|
|
Sonal Yadav answered |
|
|
Sonal Yadav answered |
|
|
Sara Al Khouri answered |
|
|
Sonal Yadav answered |
|
|
Sonal Yadav answered |
|
|
Sonal Yadav answered |
|
|
Sonal Yadav answered |
Java for EmSAT Achieve
60 videos|37 docs|12 tests
|
