Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions source/ch2_firstjavaprogram.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ Hello World!
</program>
</listing>




</section>


Expand Down Expand Up @@ -476,6 +479,51 @@ Hello World!
</choice>
</choices>
</exercise>

<exercise xml:id="java-name-color-parsons-exercise" label="java-name-color-parsons">
<statement>
<p>
Construct a complete Java program that prints your name and your favorite color to the console.
Drag the blocks into the correct order on the right.
</p>
</statement>
<blocks>
<block order="1">
<choice correct="yes">
<cline>public class NameColor {</cline>
</choice>
<choice correct="no">
<cline>class NameColor {</cline>
</choice>
</block>

<block order="2">
<choice correct="yes">
<cline> public static void main(String[] args) {</cline>
</choice>
<choice correct="no">
<cline> public static main(String[] args) {</cline>
</choice>
</block>

<block order="3">
<choice correct="yes">
<cline> System.out.println("Name: Alex");</cline>
<cline> System.out.println("Favorite Color: Blue");</cline>
</choice>
<choice correct="no">
<cline> system.out.println(Name: Alex);</cline>
<cline> System.out.println("Favorite Color: Blue")</cline>
</choice>
</block>

<block order="4">
<cline> }</cline>
<cline>}</cline>
</block>
</blocks>
</exercise>

</reading-questions>
</section>
</chapter>