0
What is system.out.format()?
What is it for? What is the difference between system.out.format and system.out.print?
1 Réponse
+ 3
the difference is with format you can use place holders(format specifiers %d %s ... ) for variable inside strings without concatenation. with print you have to concatenate string inside of the print().
ex:
string username = "M. J." ;
System.out.print("my username is " + username) ;
with format :
System.out. format("my username is '%s' ", username) ;
when you have a lot of variables to insert inside of a string it is easier to use format than using a lot of + signs.