In this way we can pass an array to a function, here this print function will print the contents of the array.
public class PassArrayToFunc {
public static void print(char [] arr) {
for(int i = 0 ; i<arr.length;i++) {
System.out.println(arr[i]);
}
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
char [] array = scan.next().toCharArray();
print(array);
scan.close();
}
}