Crenox

String.format using %s and %d

Apr 26th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. package com.zetcode.main;
  2.  
  3. public class Zetcode
  4. {
  5. public static void main(String args[])
  6. {
  7. int age = 16;
  8. String name = "Sammy";
  9.  
  10. String output = String.format("%s is %d years old.", name, age);
  11.  
  12. System.out.println(output);
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment