Find the Output Of the given Program
Attachments:
Answers
Answered by
1
Question:-
Find the output of the given program.
Solution:-
Given array,
arr[]={2,3,4,8,9,10}
Now,
arr[3]=arr[0];
Now,
the given array will be,
arr[]={2,3,4,2,9,10}
Again,
arr[0]=arr[3];
Now, the array will be,
arr[]={2,3,4,2,9,10}
k=arr[0]+arr[3]=2+2=4
arr[5]=k
Now, the array should look like,
arr[]={2,3,4,2,9,4}
Now, the contents of the array will be printed.
Hence, the output will be,
2,3,4,2,9,4,
Output:-
- 2,3,4,2,9,4,
Answered by
0
Output
2,3,4,2,9,4,
arr.length() should be arr.length
Because in java Array donot support length() function. We can find the length of array by using arr.length.
Similar questions
Social Sciences,
2 months ago
English,
2 months ago
Science,
5 months ago
Math,
5 months ago
Math,
10 months ago