Anonymous Array in Java

  • An array without name is known as anonymous array in java
  • As the array do not have any name so it can be used only once. 
  • Anonymous array is passed as an argument of method. 
  • Anonymous array is created and initialized in the same line.

How to Create Anonymous Array in Java?

A sample program is given below which shows that how 1D and 2D anonymous array can be created and used in java. In this program I have just created, initialized and passed two anonymous arrays in a method. In print() method I am printing the elements of the arrays. If you find any difficulty to understand the program then you can comment below and ask your queries.

Anonymous Array in Java

2 thoughts on “Anonymous Array in Java”

Leave a Comment

Your email address will not be published.