Arrays
- Which of these is an incorrect array declaration?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Operator new must be succeeded by array type and array size.
- Which of these is an incorrect Statement?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Array can be initialized using both new and comma separated expressions surrounded by curly braces example : int arr[5] = new int[5]; and int arr[] = { 0, 1, 2, 3, 4};
- What will this code print?
public class array
{
public static void main(String args[])
{
int arr[] = new int [7];
System.out.print(arr);
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
If we trying to print any reference variable internally, toString() will be called which is implemented to return the String in following form:
[I@2a139a55
- Which of these is necessary to specify at time of array initialization?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Row
- Which of these operators is used to allocate memory to array variable in Java?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Operator new allocates block of memory specified by the size of array, and gives the reference of memory allocated to the array variable.