+ 12

What is meaning of "%2s" in Java

2nd Feb 2019, 8:59 AM
Prakhar76
Prakhar76 - avatar
8 ответов
+ 8
It is not just a Java thing by the way. It is a general format used by several languages!
2nd Feb 2019, 4:30 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 8
I was trying to tell it to Guitar God. I'm sure you know it Serena Yvonne.
3rd Feb 2019, 8:36 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
8th Feb 2019, 6:22 AM
Prakhar76
Prakhar76 - avatar
+ 1
hi, the % character in the format part of printf tells it that the next characters tell how to format the corresponding variable to print. ..:printf("%12s" , str); saves space in the ouput line for 12 character string to print str. So if str is 8 chartacts long, the output will be padded with 4 spaces. if str is longer than 12 everthing to the right of str pushed over 12-len(str) characters
4th Feb 2019, 2:56 AM
Rick Shiffman
Rick Shiffman - avatar
- 2
a java new artificial program in such as add,subtraction, multiple
3rd Feb 2019, 6:37 PM
DIPANJANA GHATAK
DIPANJANA GHATAK - avatar