@@ -368,36 +368,6 @@ Hello World!
368368
369369
370370
371- <exercise xml : id =" java-name-color-practice-exercise" label =" java-name-color-practice" >
372- <statement >
373- <p >
374- Now that we have seen the hello world program in both Python and Java, use the ideas present in this chapter to write a Java program that prints your name and your favorite color.
375- </p >
376- <program xml : id =" java-name-color-practice" interactive =" activecode" language =" java" >
377- <input >
378- public class NameColor {
379- public static void main(String[] args) {
380- // Write your code here
381-
382- }
383- }
384- </input >
385- </program >
386- </statement >
387- <solution >
388- <program language =" java" >
389- <input >
390- public class NameColor {
391- public static void main(String[] args) {
392- System.out.println("Name: your name");
393- System.out.println("Favorite Color: your favorite color");
394- }
395- }
396- </input >
397- </program >
398- </solution >
399- </exercise >
400-
401371
402372</section >
403373
@@ -509,6 +479,49 @@ public class NameColor {
509479 </choice >
510480 </choices >
511481 </exercise >
482+
483+ <exercise xml : id =" java-name-color-parsons-exercise" >
484+ <statement >
485+ <p >
486+ Construct a complete Java program that prints your name and your favorite color to the console.
487+ Drag the blocks into the correct order on the right.
488+ </p >
489+ </statement >
490+ <blocks >
491+ <block order =" 1" >
492+ <cline >public class NameColor {</cline >
493+ </block >
494+
495+ <block order =" 2" >
496+ <cline > public static void main(String[] args) {</cline >
497+ </block >
498+
499+ <block order =" 3" >
500+ <cline > System.out.println("Name: Alex");</cline >
501+ <cline > System.out.println("Favorite Color: Blue");</cline >
502+ </block >
503+
504+ <block order =" 4" >
505+ <cline > }</cline >
506+ <cline >}</cline >
507+ </block >
508+
509+ <block correct =" no" >
510+ <cline > system.out.println(Name: Alex);</cline >
511+ <cline > System.out.println("Favorite Color: Blue")</cline >
512+ </block >
513+
514+ <block correct =" no" >
515+ <cline > def main(args):</cline >
516+ </block >
517+
518+ <block correct =" no" >
519+ <cline > public static main(String[] args) {</cline >
520+ </block >
521+
522+ </blocks >
523+ </exercise >
524+
512525 </reading-questions >
513526 </section >
514527</chapter >
0 commit comments