Formatting string in Java using return string.format(...) -


I want to return something like this: "The title book title , author book writer : $ cost "

There are bold variables I can not understand how this string is used to use the string. Format ("% s .., blah blah")

  string title = "book title "; String author = "book author"; Double cost = 100; String text = string Format ("title% s, author% s: $% .2f", title, author, cost); Println (text); // print "title book title, author book author: $ 100.00" // or System.out.pritnf ("title% s, author% s: $% .2f", title, author, cost);    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -