Question: 1 0 . In the following code an integer array is passed to a function that attempts to exchange its first two elements. Do the
In the following code an integer array is passed to a function that attempts to exchange its first two
elements. Do the elements get exchanged? If not, why not?
int array;
exchangeIntsarray;
System.out.printlnarray;
System.out.printlnarray;
public void exchangeIntsint array
int temp;
temp array;
arrayarray;
arraytemp;
In the following code a String array is passed to a function that attempts to exchange its first two
Strings. Do the elements get exchanged? If not, why not?
String arrayone"two","three","four","five";
exchangeStringsarray;
System.out.printlnarray;
System.out.printlnarray;
public void exchangeStringsString array
String temp;
temparray;
arrayarray;
arraytemp;
Recall that a superclass reference variable can be used to point to subclass objects. The following
code needs to have one cast in order to compile. Where should the cast be placed in the code?
String str"hello";
Object objstr;
String strobj;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
