How to wrap Java String.format()?

Posted by BlinK_ on Stack Overflow See other posts from Stack Overflow or by BlinK_
Published on 2010-06-06T11:56:51Z Indexed on 2010/06/06 12:02 UTC
Read the original article Hit count: 333

Filed under:
|
|
|

Hey everyone, I would like to wrap the String.format() method with in my own Logger class. I can't figure a way how to pass arguments from my method to 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);
    }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about string