Java: How to pass array to another function

Sometimes we may need in java programming to pass the value of array in another function.

Here I have given an example about the procedure of passing an array to a function.

Also, here I have shown how to find out the length of an array and how to retrieve or get the value of the array after passing it to another function.

This tutorial will help you to understand the basic of array and how to declare array in java.


 class ArrayPassing


 public static void checking(String[] u)




  System.out.println(“Array is entered into Checking function”);

  System.out.println(“Array Length:”+u.length);

  System.out.println(“Third index value is:”+u[2]);




         public static void main(String args[])


                                    String[] d;

                                    d = new String[3];








Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 348 other followers

%d bloggers like this: