Mega Code Archive

 
Categories / Java Tutorial / Internationalization
 

Formatting a Message Containing a Number

import java.text.MessageFormat; public class Main {   public static void main(String[] argv) throws Exception {     Object[] params = new Object[] { new Integer(123), new Integer(1234) };     String msg = MessageFormat.format("{0} a''s and {1} b''s", params);     System.out.println(msg);   } }