Home java System.out.Printf in java

System.out.Printf in java

Author

Date

Category

I need to do the following. For example, if the number is three-digit, then you leave. If it is unambiguous or double-digit, then add two zero or one. So, how to do it in one line using PrintF?


Answer 1, Authority 100%

Add the drive zeros in this way:

string.format ("% 03D", NUM);

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions