there is a line in the coding as:
System.out.printf(" input float(e.g. %5.2f): ", 2.43);
the output is:
input float(e.g. 2.43):
Q:please explain this line completely???????????????
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
there is a line in the coding as:
System.out.printf(" input float(e.g. %5.2f): ", 2.43);
the output is:
input float(e.g. 2.43):
Q:please explain this line completely???????????????
What did the API tell you?
PrintStream (Java Platform SE 6)
Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
In future, please post in the correct forum. This is the Members Introduction forum..
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.
i think that is correct output..
if you can see you put this "%5.2f" which is equivalent into FLOAT..that has 2decimal places
in C/C++
if you write that
it means you have a value to transfer
like this
System.out.printf(" input float(e.g. %5.2f): ", 2.43);
you transfer the value of 2.43 into float..
thats why the output is
input float(e.g. 2.43):
hmm i think that is the explanation.. hmmm..
you use SYSO thats why they print the output.
input float(e.g. 2.43):
like PRINTF /COUT
-------------------------------
System.out.printf(" input float(e.g. %5.2f): ", 2.43);
input float(e.g. 2.43):