Skip to content

Commit 825ffee

Browse files
authored
Shows the difference between print and println
Prints two lines of output representing a rocket countdown.
1 parent f007a49 commit 825ffee

File tree

1 file changed

+20
-0
lines changed
  • textbook work/java software solutions/2. Data and Expressions

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//********************************************************************
2+
// Countdown.java Author: Lewis/Loftus
3+
//
4+
// Demonstrates the difference between print and println.
5+
//********************************************************************
6+
public class Countdown
7+
{
8+
//-----------------------------------------------------------------
9+
// Prints two lines of output representing a rocket countdown.
10+
//-----------------------------------------------------------------
11+
public static void main (String[] args)
12+
{
13+
System.out.print("Three... ");
14+
System.out.print("Two... ");
15+
System.out.print("One... ");
16+
System.out.print("Zero... ");
17+
System.out.println("Liftoff!"); // appears on first output line
18+
System.out.println("Houston, we have a problem.");
19+
}
20+
}

0 commit comments

Comments
 (0)