Purchase Solution

Statements Evaluation

Not what you're looking for?

Ask Custom Question

Show what is printed by each of the following statements. If a statement is incorrect, indicate why.

a) System.out.printf("%-10dn",10000);
b) System.out.printf("%cn", "this is a string");
c) System.out.printf("%8.3fn",1024.987654);
d) System.out.printf("%#on%#xn",17,17);
e) System.out.printf("%dn%+dn",1000000, 1000000);
f) System.out.printf("%10.2en",444.93738);
g) System.out.printf("%dn", 10.987);

Purchase this Solution

Solution Summary

This solution identifies if the statement is incorrect and correct and briefly explains why.

Solution Preview

a) System.out.printf("%-10dn",10000);
The output is: 10000 n
b) System.out.printf("%cn", "this is a string");
It throws java.util.IllegalFormatConversionException.
Because %c ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

C# variables and classes

This quiz contains questions about C# classes and variables.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Javscript Basics

Quiz on basics of javascript programming language.