Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the output from the following print statements, assuming float myFloat = 4 5 . 1 3 4 2 f; 1 ) System.out.printf (

What is the output from the following print statements, assuming
float myFloat =45.1342f;
1)
System.out.printf("%+.5f", myFloat);
+45.13420
Check
Show answer
Correct
+45.13420
The + indicates a + should output before a positive number, and .5 indicates 5 digits should follow the decimal point.
2)
System.out.printf("%.3e", myFloat);
4.513e+01
Check
Show answer
Correct
4.513e+01
e is used to display float values in scientific notation, .3 specifies the digits to print following the decimal point
3)
System.out.printf("%09.2f", myFloat);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago