You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/ch3_javadatatypes.ptx
+15-8Lines changed: 15 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -91,12 +91,12 @@
91
91
</p>
92
92
93
93
<p>
94
-
Let’s look at a simple Python function which converts a Fahrenheit temperature to Celsius.
94
+
<xrefref="python-temperature-conversion"text="type-global"/> is a simple Python function which converts a Fahrenheit temperature to Celsius.
95
95
If this program were run on the command-line, you would enter the temperature when prompted – the Javascript pop-up for input is only an artifact of the digital textbook.
Next, lets look at the Java equivalent. If this program were run on the command-line, you would enter the temperature when prompted – the “Input for Program” text box is only an artifact of the digital textbook.
111
+
Next, <xrefref="java-temperature-conversion"text="type-global"/> is the Java equivalent. If this program were run on the command-line, you would enter the temperature when prompted – the “Input for Program” text box is only an artifact of the digital textbook.
There are several new concepts introduced in this example. We will look at them in the following order:
@@ -247,7 +250,9 @@ public class TempConv {
247
250
For Python programmers, the following error is likely to be even more common. Suppose we forgot the declaration for <c>cel</c> and instead left line 6 blank. What would happen when we type <c>javac TempConv.java</c> on the command line?
System.out.println("The temperature in C is: " + cel);
260
265
^
261
266
2 errors
262
-
</pre>
267
+
</code>
268
+
</program>
269
+
</listing>
263
270
264
271
<p>
265
-
When you see the first kind of error, where the symbol is on the left side of the equals sign, it usually means that you have not declared the variable. If you have ever tried to use a Python variable that you have not initialized the second error message will be familiar to you. The difference here is that we see the message before we ever try to test our program. More common error messages are discussed in the section <xrefref="common-mistakes-id1"/>.
272
+
When you see the first kind of error in <xrefref="java-temperature-conversion-error"text="type-global"/> , where the symbol is on the left side of the equals sign, it usually means that you have not declared the variable. If you have ever tried to use a Python variable that you have not initialized the second error message will be familiar to you. The difference here is that we see the message before we ever try to test our program. More common error messages are discussed in the section <xrefref="common-mistakes-id1"/>.
0 commit comments