capture the output of printf into another variable

Hi ,

I wonder if in java I can pipe the below output of the printf into a variable:
System.out.printf(" This is a test %s\n", myVariable);

I want to keep the output of the printf command to create my history array.

Thanks.

Consider sprintf:

Formatted Printing for Java (sprintf)

1 Like

thanks Jim very handy this sprintf. Thanks!!!