Science, asked by Anonymous, 5 hours ago

What is an anonymous array? Give example​

Answers

Answered by MrPoizon
3

\huge{\mathcal{\orange{✓{\pink{\underline\purple{Qüêstìøñ}}}}}}➡️

  • What is an anonymous array? Give example

\huge{\mathfrak{\blue{❥{\pink{\underline\green{ᴀ᭄ɴsᴡᴇʀ}}}}}}{\red{\:\star}}

Anonymous arrays :

In addition to the above specified ways you can create an array without specifying any name such arrays are known as anonymous arrays. Since it doesn’t have name to refer you can use it only once in your program. Generally, anonymous arrays are passed as arguments to methods.

You can create an anonymous array by initializing it at the time of creation.

EXAMPLE

In the following Java program the arrayToUpperCase() method accepts an array of Strings, converts each String to upper case and prints the results.

To this method we are passing an anonymous array of Strngs as a parameter.

public class AnonymousArray {

public static void arrayToUpperCase(String [] array) {

for(int i=0; i< array.length; i++) {

char[] ch = array[i].toCharArray();

for(int j=0; j<ch.length; j++){

ch[j] = Character.toUpperCase(ch[j]);

}

System.out.println(new String(ch));

}

}

public static void main(String args[]) {

arrayToUpperCase(new String[] {"Krishna", "Vishnu", "Dhana", "Rupa", "Raja", "Kavya"});

}

}

Output

KRISHNA

VISHNU

DHANA

RUPA

RAJA

KAVYA

ig:silent___readers

\huge{\mathscr{\red{please \: mark \: brainliest}}}

\large\mathbb\fcolorbox{lime}{black}{\blue{\underline\pink{THANK \ YOU }}}

\huge\blue{\boxed{\red{\underline{\mathcal{\red{s}\green{w}\pink{a }\orange{g}\blue{a}\purple{t}}}}}}

Answered by abhi77799
0

Answer:

Array :- Batch, bundle, cluster, design, pattern...etc..

Similar questions