current position:Home>Generics and void are used at the same time

Generics and void are used at the same time

2022-02-03 02:39:52 CSDN Q & A

Java   public static < E > void printArray( E[] inputArray )   {                 for ( E element : inputArray ){                    System.out.printf( "%s ", element );         }         System.out.println();    }

This is a little confused , nothing void Preceded by generic . No addition %s You're going to report a mistake

Refer to the answer 1:

No addition void Have you added any other return types

Refer to the answer 2:

Refer to the answer 3:

printf There are only two ways
printf(String format, Object ... args)
printf(Locale l, String format, Object ... args)
Printing is print / println
Brother, don't put Java Follow c Confused.

Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.

Random recommended