What is the result?

Give:

What is the result?

Give:

What is the result?

A.
There are 27 sports cars and 5 trucks

B.
There are 27 convertibles and 5 trucks

C.
There are 9 sports cars and 5 trucks

D.
There are 9 convertibles and 5 trucks

E.
IllegalFormatConversionException is thrown at runtime

Explanation:

Strings are immutable, therefore no change at line: svar.replace(svar,”convertibles”);
Format String Syntax:
%[argument_index$][flags][width][.precision]conversion
The optional argument_index is a decimal integer indicating the position of the argument in the
argument list.
The first argument is referenced by “1$”, the second by “2$”, etc.
The optional flags is a set of characters that modify the output format. The set of valid flags
depends on theconversion.
‘s’, ‘S’ general

‘d’ integral The result is formatted as a decimal / integer



Leave a Reply 2

Your email address will not be published. Required fields are marked *