JavaDeploy
SiteMap
Readers Writers
Java Streams
Java Programming
Java Language
Program Flow
«Prev
Next»
Java Programming
Java Technology
Useful Technology
Acquiring Java SDK
Java Compiler
Tic Tac Toe Applet
Java Applet Viewer
Java TM Interpreter
Java SDK Conclusion
OO Programming
OO Fundamentals
Understanding Classes
Object Communication
Defining Objects
Adding Behavior Methods
OO Programming Conclusion
OO Programming - Quiz
122
Java Programs
Java Api
Applications Applets
Java main() method
Static Class Member
Command Line Arguments
Building String Characters
Standard IO Communication
Application Construction
122
Program Flow
Conditional Branching
Conditional Ternary Operator
Switch Statement
For Loops
foreach Loop
Nested Loops
while Loops
doWhile Loop
Break Statement
Control Flow Conclusion
Programming Fundamentals
Identifiers, Keywords, Literals
Java Comments
Java Data Types
Storing Data Arrays
Manipulating Text
Evaluating Expressions
Numeric Operators
Boolean Assignment Operators
Compound Operators
Java Language Conclusion
Object Classes
Inheritance Fundamentals
While Loops - Exercise
Using Java while loop
Objective:
Practice using the while loop.
Exercise Grading
The full credit for this exercise is 10 points. To receive full credit, you willl need to successfully create the source code for the application. You will submit your source code.
Exercise instructions
Develop a command-line application named PrintMessage that uses a
while
loop to print a message a number of times. The message and number of repetitions should be provided as command-line arguments. In this application you will need to convert a command-line argument from a
String
to an
int
. The static method
parseInt()
in class
Integer
provides this functionality. Here is an example of
parseInt()
in action:
String s = new String("123"); int n = Integer.parseInt(s);
What to submit to the course
In the text box below, cut and paste the source code for the PrintMessage application. Click,
Submit
to submit the code .