Question: Consider the following method: public void dosomething ( int [ ] a ) { a [ 2 ] = a [ 1 ] a [

Consider the following method:
public void dosomething(int[] a)
{
a[2]=a[1]
a[3]=a[2];
}
If a is declared as
int []a={1,2,3,4};
what are the values in a after dosomething (a) is called?
A.,1,2,3,4
B.,1,1,2,4
f.1,2,2,3
O.1,2,2,2
 Consider the following method: public void dosomething(int[] a) { a[2]=a[1] a[3]=a[2];

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!