Response:
In Java
public static void printArray(int myarr[], String s){
for(int i = 0; i<myarr.length;i++){
System.out.print(myarr[i]+s);
}
}
Explanation:
The static method is defined along with the integer array and string parameter
public static void printArray(int myarr[], String s){
The for loop iterates through the array elements
for(int i = 0; i<myarr.length;i++){
This line outputs each array element followed by the specified string
System.out.print(myarr[i]+s);
}
}
The method can be invoked from the main using:
printArray(myarr,s);
Where myarr and s are local parameters in the main function