From ff0772dd5e771693f79e0d69b4523bcb10d5858a Mon Sep 17 00:00:00 2001 From: Habiba Sorour Date: Wed, 5 Aug 2026 22:19:44 +0300 Subject: [PATCH 1/4] added an exercise code block --- source/ch2_firstjavaprogram.ptx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/source/ch2_firstjavaprogram.ptx b/source/ch2_firstjavaprogram.ptx index 8fa1e56..974964b 100644 --- a/source/ch2_firstjavaprogram.ptx +++ b/source/ch2_firstjavaprogram.ptx @@ -366,6 +366,39 @@ Hello World! + + + + +

+ 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. +

+ + +public class NameColor { + public static void main(String[] args) { + // Write your code here + + } +} + + +
+ + + +public class NameColor { + public static void main(String[] args) { + System.out.println("Name: Alex"); + System.out.println("Favorite Color: Blue"); + } +} + + + +
+ + From 1bf49ad56c5662be958be25f9fc12b48fb07dc8a Mon Sep 17 00:00:00 2001 From: Habiba Sorour Date: Wed, 5 Aug 2026 22:22:05 +0300 Subject: [PATCH 2/4] unify solution --- source/ch2_firstjavaprogram.ptx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ch2_firstjavaprogram.ptx b/source/ch2_firstjavaprogram.ptx index 974964b..cbf8ca3 100644 --- a/source/ch2_firstjavaprogram.ptx +++ b/source/ch2_firstjavaprogram.ptx @@ -389,8 +389,8 @@ public class NameColor { public class NameColor { public static void main(String[] args) { - System.out.println("Name: Alex"); - System.out.println("Favorite Color: Blue"); + System.out.println("Name: your name"); + System.out.println("Favorite Color: your favorite color"); } } From 7550ad240d1d9e2d8d4c284cf648749f96e99226 Mon Sep 17 00:00:00 2001 From: Habiba Sorour Date: Thu, 6 Aug 2026 16:55:00 +0300 Subject: [PATCH 3/4] changed to parson's problem --- source/ch2_firstjavaprogram.ptx | 73 +++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/source/ch2_firstjavaprogram.ptx b/source/ch2_firstjavaprogram.ptx index cbf8ca3..2289adb 100644 --- a/source/ch2_firstjavaprogram.ptx +++ b/source/ch2_firstjavaprogram.ptx @@ -368,36 +368,6 @@ Hello World! - - -

- 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. -

- - -public class NameColor { - public static void main(String[] args) { - // Write your code here - - } -} - - -
- - - -public class NameColor { - public static void main(String[] args) { - System.out.println("Name: your name"); - System.out.println("Favorite Color: your favorite color"); - } -} - - - -
- @@ -509,6 +479,49 @@ public class NameColor { + + + +

+ 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. +

+
+ + + public class NameColor { + + + + public static void main(String[] args) { + + + + System.out.println("Name: Alex"); + System.out.println("Favorite Color: Blue"); + + + + } + } + + + + system.out.println(Name: Alex); + System.out.println("Favorite Color: Blue") + + + + def main(args): + + + + public static main(String[] args) { + + + +
+ \ No newline at end of file From 1389b473141cd1cf45799cb8692bc2427b6bf447 Mon Sep 17 00:00:00 2001 From: Habiba Sorour Date: Thu, 6 Aug 2026 18:56:09 +0300 Subject: [PATCH 4/4] added or tags --- source/ch2_firstjavaprogram.ptx | 42 +++++++++++++++++---------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/source/ch2_firstjavaprogram.ptx b/source/ch2_firstjavaprogram.ptx index 2289adb..c1cb7a1 100644 --- a/source/ch2_firstjavaprogram.ptx +++ b/source/ch2_firstjavaprogram.ptx @@ -480,7 +480,7 @@ Hello World! - +

Construct a complete Java program that prints your name and your favorite color to the console. @@ -489,36 +489,38 @@ Hello World! - public class NameColor { + + public class NameColor { + + + class NameColor { + - + - public static void main(String[] args) { + + public static void main(String[] args) { + + + public static main(String[] args) { + - System.out.println("Name: Alex"); - System.out.println("Favorite Color: Blue"); + + System.out.println("Name: Alex"); + System.out.println("Favorite Color: Blue"); + + + system.out.println(Name: Alex); + System.out.println("Favorite Color: Blue") + } } - - - system.out.println(Name: Alex); - System.out.println("Favorite Color: Blue") - - - - def main(args): - - - - public static main(String[] args) { - -