string.format examples java
Example 1: formartted string java
String str = String.format( "Hello \n World \n my name is %s and i'm %d years old" , "Paul", 27);
Example 2: java string format
public class FormatExample{
public static void main(String args[]){
String name="sonoo";
String sf1=String.format("name is %s",name);
String sf2=String.format("value is %f",32.33434);
String sf3=String.format("value is %32.12f",32.33434);
System.out.println(sf1);
System.out.println(sf2);
System.out.println(sf3);
}}