Skip to content

Commit bafd5ef

Browse files
committed
add listing tags
1 parent f245fe6 commit bafd5ef

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

source/ch9_commonmistakes.ptx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
<p>
149149
Unlike Python, where you can create a new object without explicitly using a keyword, Java requires the <c>new</c> keyword to instantiate a new object.
150150
</p>
151+
<listing xml:id="new-keyword-error">
151152
<program language="java" interactive="activecode" line-numbers="yes">
152153
<code>
153154
// Histo.java // The filename for this example
@@ -164,6 +165,7 @@
164165
} // End of class
165166
</code>
166167
</program>
168+
</listing>
167169
<p>
168170
This error message occurs when you forget to use the <c>new</c> keyword to instantiate an object.
169171
Specifically, on line 8 of <c>Histo.java</c>, <c>data = Scanner(new File("test.dat"));</c> leads to a 'cannot find symbol' error.

0 commit comments

Comments
 (0)