Skip to content
10 changes: 5 additions & 5 deletions source/ch2_firstjavaprogram.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ $ ls -l Hello.*
<p>
The command <c>javac</c> compiles our java source code into compiled byte code and saves it in a file called <c>Hello.class</c>.
<c>Hello.class</c> is a binary file so you won&#x2019;t learn much if you try to examine the class file with an editor.
Hopefully you didn&#x2019;t make any mistakes, but if you did you may want to consult the <xref ref="common-mistakes-id1"/> section for helpful hints on compiler errors.
Hopefully you didn&#x2019;t make any mistakes, but if you did you may want to consult the <xref ref="common-mistakes"/> section for helpful hints on compiler errors.
</p>

<p>
Expand Down Expand Up @@ -374,7 +374,7 @@ Hello World!

<section xml:id="lets_look_java_program_summary">
<title>Summary &amp; Reading Questions</title>
<p><ol label="1">
<p><ol>
<li>
<p>Java programs must be compiled before execution, unlike Python which is interpreted directly.</p>
</li>
Expand All @@ -398,7 +398,7 @@ Hello World!
</li>
</ol></p>
<reading-questions xml:id="rqs-hello-java">
<exercise label="hello-java-1">
<exercise label="hello-java-question-true-java-program">
<statement>
<p>Which of the following must be true of every Java program?</p>
</statement>
Expand All @@ -421,7 +421,7 @@ Hello World!
</choice>
</choices>
</exercise>
<exercise label="hello-java-2">
<exercise label="hello-java-question-purpose-of-javac">
<statement>
<p>What is the purpose of the <c>javac</c> command?</p>
</statement>
Expand All @@ -444,7 +444,7 @@ Hello World!
</choice>
</choices>
</exercise>
<exercise label="hello-java-3">
<exercise label="hello-java-question-end-of-statement">
<statement>
<p>What symbol does Java use to indicate the end of a statement?</p>
</statement>
Expand Down
10 changes: 5 additions & 5 deletions source/ch3_javadatatypes.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public class TempConv {
</listing>

<p>
When you see the first kind of error in <xref ref="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 <xref ref="common-mistakes-id1"/>.
When you see the first kind of error in <xref ref="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 <xref ref="common-mistakes"/>.
</p>

<p>
Expand Down Expand Up @@ -1170,9 +1170,9 @@ public class HistoMap {



<section xml:id="chapter3_summary">
<section xml:id="data_types_summary">
<title>Summary &amp; Reading Questions</title>
<p><ol label="1">
<p><ol>
<li>
<p>All variables must be declared with their type before use in Java due to static typing.</p>
</li>
Expand All @@ -1195,7 +1195,7 @@ public class HistoMap {
<p>Maps (<c>HashMap</c> and <c>TreeMap</c>) are Java's equivalent to Python dictionaries for storing key-value pairs.</p>
</li>
</ol></p>
<reading-questions xml:id="rqs-summary3">
<reading-questions xml:id="rqs-summary-data-types">
<exercise label = "summary-arraylist">
<statement>
<p>What is the correct way to declare an ArrayList that will hold String objects in Java?</p>
Expand Down Expand Up @@ -1235,7 +1235,7 @@ public class HistoMap {
</choice>
</choices>
</exercise>
<exercise label = "summary-autoboxing">
<exercise label ="summary-autoboxing">
<statement>
<p>The process of automatically converting between primitive types and their Object wrapper classes in Java is called:</p>
</statement>
Expand Down
6 changes: 3 additions & 3 deletions source/ch4_conditionals.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,9 @@ public class Ternary {
</p>

</section>
<section xml:id="chapter4_summary">
<section xml:id="conidtionals-summary">
<title>Summary &amp; Reading Questions</title>
<p><ol label="1">
<p><ol>
<li>
<p>Java requires parentheses around the condition and curly braces for code blocks in <c>if</c> statements, unlike Python which uses indentation alone.</p>
</li>
Expand All @@ -630,7 +630,7 @@ public class Ternary {
</p>
</li>
</ol></p>
<reading-questions xml:id="rqs-summary4">
<reading-questions xml:id="rqs-summary-conditionals">
<exercise label="summary-if-parentheses">
<statement>
<p>Which is a correct Java <c>if</c> statement syntax?</p>
Expand Down
6 changes: 3 additions & 3 deletions source/ch5_loopsanditeration.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,10 @@ public class DoWhileExample {
</exercise>

</section>
<section xml:id="chapter5_summary">
<section xml:id="loops-summary">
<title>Summary &amp; Reading Questions</title>
<p>
<ol label="1">
<ol>
<li>
<p>Java’s <c>for</c> loop syntax allows you to control loop initialization, condition, and update in one line using the format <c>for (init; condition; update)</c>.</p>
</li>
Expand All @@ -376,7 +376,7 @@ public class DoWhileExample {
</ol>
</p>

<reading-questions xml:id="rqs-5">
<reading-questions xml:id="rqs-summary-loops">

<exercise label="summary-for-loop-structure">
<statement>
Expand Down
2 changes: 1 addition & 1 deletion source/ch7_recursion.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public class ArrayProcessor {

<section xml:id="recursion_summary">
<title>Summary &amp; Reading Questions</title>
<p><ol label="1">
<p><ol>
<li>
<p>Recursion solves problems by defining a <em>base case</em> and a <em>recursive step</em>; each call reduces the problem size until the base case is reached.</p>
</li>
Expand Down
6 changes: 3 additions & 3 deletions source/ch8_filehandling.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,9 @@ public class DeleteFile {
</p>
</section>

<section xml:id="chapter8_summary">
<section xml:id="file_handling_summary">
<title>Summary &amp; Reading Questions</title>
<p><ol label="1">
<p><ol>
<li>
<p>To work with files in Java, you must import specific classes like <c>java.io.File</c>, <c>java.io.FileWriter</c>, and handle exceptions such as <c>IOException</c>.</p>
</li>
Expand All @@ -592,7 +592,7 @@ public class DeleteFile {
<p>You can delete a file using the <c>delete()</c> method on a <c>File</c> object, which returns <c>true</c> if successful.</p>
</li>
</ol></p>
<reading-questions xml:id="rqs-summary8">
<reading-questions xml:id="rqs-summary-file-handling">
<exercise label="summary-imports">
<statement>
<p>Which import is needed to create and manipulate files in Java?</p>
Expand Down
10 changes: 5 additions & 5 deletions source/ch9_commonmistakes.ptx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>

<!-- Generated by Docutils 0.19 -->
<chapter xml:id="common-mistakes-id1">
<chapter xml:id="common-mistakes">
<title>Common Mistakes</title>

<introduction>
Expand Down Expand Up @@ -219,7 +219,7 @@

<section xml:id="common-mistakes-summary">
<title>Summary &amp; Reading Questions</title>
<p><ol label="1">
<p><ol>
<li>
<p>In Java, every variable must be declared with its type before use; undeclared variables cause compilation errors.</p>
</li>
Expand All @@ -240,7 +240,7 @@
</li>
</ol></p>
<reading-questions xml:id="rqs-common-mistakes">
<exercise label="cm-1">
<exercise label="common-mistake-declare-variable">
<statement>
<p>What happens if you use a variable in Java without declaring it first?</p>
</statement>
Expand All @@ -263,7 +263,7 @@
</choice>
</choices>
</exercise>
<exercise label="cm-2">
<exercise label="common-mistake-imports">
<statement>
<p>Why must you include import statements for classes like <c>Scanner</c>?</p>
</statement>
Expand All @@ -286,7 +286,7 @@
</choice>
</choices>
</exercise>
<exercise label="cm-3">
<exercise label="common-mistake-generics">
<statement>
<p>What warning occurs when you use an <c>ArrayList</c> without specifying a type?</p>
</statement>
Expand Down