File tree 1 file changed +26
-0
lines changed
textbook work/java software solutions/2. Data and Expressions 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ //********************************************************************
2
+ // Facts.java Author: Lewis/Loftus
3
+ //
4
+ // Demonstrates the use of the string concatenation operator and the
5
+ // automatic conversion of an integer to a string.
6
+ //********************************************************************
7
+ public class Facts
8
+ {
9
+ //-----------------------------------------------------------------
10
+ // Prints various facts.
11
+ //-----------------------------------------------------------------
12
+ public static void main (String [] args )
13
+ {
14
+ // Strings can be concatenated into one long string
15
+ System .out .println ("We present the following facts for your "
16
+ + "extracurricular edification:" );
17
+ System .out .println ();
18
+ // A string can contain numeric digits
19
+ System .out .println ("Letters in the Hawaiian alphabet: 12" );
20
+ // A numeric value can be concatenated to a string
21
+ System .out .println ("Dialing code for Antarctica: " + 672 );
22
+ System .out .println ("Year in which Leonardo da Vinci invented "
23
+ + "the parachute: " + 1515 );
24
+ System .out .println ("Speed of ketchup: " + 40 + " km per year" );
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments