Computer Science, asked by DynamicNinja, 4 months ago

What is an anonymous array? Give example?​

Answers

Answered by hareem23
3

In Java, an Array without having any name is called an anonymous array. Using anonymous array we can pass an array with user values without the referenced variable. new int [][] { {40, 50}, {10, 20, 30} }; For Anonymous array creation, do not mention size in [] .

Answered by ItzBeautyBabe
3

\huge{\tt{\red{}\green{A}\purple{N}\pink{S}\blue{W}\orange{E}\red{R}}}

An array in Java without any name is anonymous array. It is an array just for creating and using instantly. We can create an array without name, such type of nameless arrays are called anonymous array. The main purpose of anonymous array is just for instant use (just for one time usage) .

Few examples of creating anonymous array in java: anonymous int array : new int[] { 1, 2, 3, 4}; anonymous String array : new String[] {"one", "two", "three"}; anonymous char array : new char[] {'a', 'b', 'c');

Similar questions