Ciao a tutti, vorrei inserire il metodo String.format() nella mia stessa classe Logger. Non riesco a capire come passare argomenti dal mio metodo a String.format().Come avvolgere Java String.format()?
public class Logger
{
public static void format(String format, Object... args)
{
print(String.format(format, args)); // <-- this gives an error obviously.
}
public static void print(String s)
{
System.out.println(s);
}
}
E quale sarebbe l'errore? –
Sì. Qual è l'errore? Mi sta bene. L'errore –
arriva probabilmente se si supera più di un argomento – eugeneK