You do this:
private void PassArray() {
String[] arrayw = new String[4]; //populate array
PrintA(arrayw);
}
private void PrintA(String[] a) {
//do whatever with array here
}
Just pass it as any other variable.
In Java, arrays are passed by reference.
More Related Contents:
- How does array work? How to create a basic array data structure using java? [closed]
- Type mismatch: cannot convert from double to double[]
- error: incompatible types: ‘Something’ cannot convert to ‘Something’
- How do I determine whether an array contains a particular value in Java?
- How do I reverse an int array in Java?
- Do Java arrays have a maximum size?
- How do I remove objects from an array in Java?
- Java arrays printing out weird numbers and text [duplicate]
- How to convert an ArrayList containing Integers to primitive int array?
- How to convert Java String into byte[]?
- Sort a two dimensional array based on one column
- Comparing two integer arrays in Java
- Any way to declare an array in-line?
- How to make an array of arrays in Java
- Java – generate Random range of specific numbers without duplication of those numbers – how to?
- Converting String to “Character” array in Java
- Grab a segment of an array in Java without creating a new array on heap
- What is the most elegant way to check if all values in a boolean array are true?
- Java: Reading integers from a file into an array
- Sort ArrayList of Array in Java
- Gets byte array from a ByteBuffer in java
- Arrays.asList() of an array
- How does the enhanced for statement work for arrays, and how to get an iterator for an array?
- Converting char[] to byte[]
- Convert a 2D array index into a 1D index
- Easiest way to convert a Blob into a byte array
- add an element to int [] array in java [duplicate]
- Finding prime numbers with the Sieve of Eratosthenes (Originally: Is there a better way to prepare this array?)
- How to remove element from an array
- Compare two arrays of primitives in Java?