Click here to watch in Youtube :
https://www.youtube.com/watch?v=Lo0gVohVGo8&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java String(format method) |
/* * public static String format(String format, * Object... args) * * Returns a formatted string using the specified * format string and arguments. * * Parameters: * ---------- * * format - A format string * * args - Arguments referenced by the format * specifiers in the format string */ public class FormatDemo { public static void main(String[] args) { float floatVar = 12.3f; int intVar = 100; String stringVar = "Hello,"; String fs = String.format("The value of the float " + "variable is %f, while " + "the value of the " + "integer variable is %d, " + " and the string is %s", floatVar, intVar, stringVar); System.out.println(fs); } }
The value of the float variable is 12.300000, while the value of the integer variable is 100, and the string is Hello,
https://sites.google.com/site/javaee4321/java/StringDemo_Format_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringDemo_Format_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/ae1c81370f840697c745970d52d13d8987910b41/BasicJava/StringDemo_Format_App/?at=master
See also:
No comments:
Post a Comment