From f65e6f8bcdbb33bfb798061ea91664e9ea78005e Mon Sep 17 00:00:00 2001 From: Shivam Madan Date: Mon, 24 Nov 2025 14:28:16 +0530 Subject: [PATCH] Update notebook samples --- samples/notebooks/LearningSample.ijnb | 89 +++-- samples/notebooks/LearningSample_Java17+.ijnb | 329 ++++++++++++++++++ 2 files changed, 391 insertions(+), 27 deletions(-) create mode 100644 samples/notebooks/LearningSample_Java17+.ijnb diff --git a/samples/notebooks/LearningSample.ijnb b/samples/notebooks/LearningSample.ijnb index fe8b613..3604a52 100644 --- a/samples/notebooks/LearningSample.ijnb +++ b/samples/notebooks/LearningSample.ijnb @@ -10,7 +10,7 @@ { "id": "1c4583aa-a137-4e55-915e-5c218bc02744", "cell_type": "markdown", - "source": "\n***Sample Note:***\n\nThis notebook demonstrates the use of notebooks in helping learners explore some basic concepts of Java with small, self-contained examples.\n\n**What this sample shows:**\n\n- Markdown-formatted guidance with clearly organized sections\n- Running code cells displays output inline\n - Optionally includes saved outputs from prior runs for reference\n\n**Prerequisites:**\n\nThis notebook requires Java 17+ to run all the cells successfully.", + "source": "\n***Sample Note:***\n\nThis notebook demonstrates the use of notebooks in helping learners explore some basic concepts of Java with small, self-contained examples.\n\n**What this sample shows:**\n\n- Markdown-formatted guidance with clearly organized sections\n- Running code cells displays output inline\n - Optionally includes saved outputs from prior runs for reference\n\n**Prerequisites:**\n\nThis notebook requires Java 25+ to run all the cells successfully.", "metadata": { "language": "markdown", "id": "1c4583aa-a137-4e55-915e-5c218bc02744" @@ -25,6 +25,39 @@ "id": "21015b6e-8260-43d6-a629-4e7c2b5d6ff3" } }, + { + "id": "9de98c25-6285-416d-8a56-d9cad1675efa", + "cell_type": "markdown", + "source": "### Greetings !!\nExecute the code snippet below and enter your name in the input box that opens at the top of your screen.", + "metadata": { + "language": "markdown", + "id": "9de98c25-6285-416d-8a56-d9cad1675efa" + } + }, + { + "id": "3df5b924-bc0e-47fd-a556-dcf71eeabfb8", + "cell_type": "code", + "source": "\nString name = IO.readln(\"Enter your name:\\n\");\nIO.println(\"Hello \"+name+\" !!\");", + "metadata": { + "language": "java", + "id": "3df5b924-bc0e-47fd-a556-dcf71eeabfb8", + "executionSummary": { + "executionOrder": 1, + "success": true + } + }, + "execution_count": 1, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "Enter your name:\nHello !!\n" + }, + "metadata": {}, + "execution_count": 1 + } + ] + }, { "id": "98ba9913-0b56-458d-ab0e-0bdad5744159", "cell_type": "markdown", @@ -55,16 +88,16 @@ { "id": "d5dcf964-eeb5-4966-9ac6-58352b3606a8", "cell_type": "code", - "source": "byte smallNumber = 127;\nshort mediumNumber = 32000;\nint regularNumber = 2147483647; \nlong bigNumber = 9223372036854775807L;\n\nSystem.out.println(\"=== Integer data types Demo ===\");\nSystem.out.println(\"byte: \" + smallNumber);\nSystem.out.println(\"short: \" + mediumNumber);\nSystem.out.println(\"int: \" + regularNumber);\nSystem.out.println(\"long: \" + bigNumber);", + "source": "byte smallNumber = 127;\nshort mediumNumber = 32000;\nint regularNumber = 2147483647; \nlong bigNumber = 9223372036854775807L;\n\nIO.println(\"=== Integer data types Demo ===\");\nIO.println(\"byte: \" + smallNumber);\nIO.println(\"short: \" + mediumNumber);\nIO.println(\"int: \" + regularNumber);\nIO.println(\"long: \" + bigNumber);", "metadata": { "language": "java", "id": "d5dcf964-eeb5-4966-9ac6-58352b3606a8", "executionSummary": { - "executionOrder": 1, + "executionOrder": 2, "success": true } }, - "execution_count": 1, + "execution_count": 2, "outputs": [ { "output_type": "execute_result", @@ -72,7 +105,7 @@ "text/plain": "=== Integer data types Demo ===\nbyte: 127\nshort: 32000\nint: 2147483647\nlong: 9223372036854775807\n" }, "metadata": {}, - "execution_count": 1 + "execution_count": 2 } ] }, @@ -88,15 +121,16 @@ { "id": "71fbbad5-54d6-4d7a-8840-2101f61ca0a4", "cell_type": "code", - "source": "\nfloat decimal1 = 3.14f;\ndouble decimal2 = 3.141592653589793;\n\nSystem.out.println(\"=== Floating point data types Demo ===\");\nSystem.out.println(\"float: \" + decimal1);\nSystem.out.println(\"double: \" + decimal2);\n", + "source": "\nfloat decimal1 = 3.14f;\ndouble decimal2 = 3.141592653589793;\n\nIO.println(\"=== Floating point data types Demo ===\");\nIO.println(\"float: \" + decimal1);\nIO.println(\"double: \" + decimal2);\n", "metadata": { "language": "java", + "id": "71fbbad5-54d6-4d7a-8840-2101f61ca0a4", "executionSummary": { - "executionOrder": 2, + "executionOrder": 3, "success": true } }, - "execution_count": 2, + "execution_count": 3, "outputs": [ { "output_type": "execute_result", @@ -104,7 +138,7 @@ "text/plain": "=== Floating point data types Demo ===\nfloat: 3.14\ndouble: 3.141592653589793\n" }, "metadata": {}, - "execution_count": 2 + "execution_count": 3 } ] }, @@ -120,9 +154,10 @@ { "id": "dff83078-4563-4831-b012-1f5e6c61df5d", "cell_type": "code", - "source": "boolean isJavaFun = true;\nchar firstAlphabet = 'A'; \n\nSystem.out.println(\"=== Other primitive data types Demo ===\");\nSystem.out.println(\"boolean: \" + isJavaFun);\nSystem.out.println(\"char: \" + firstAlphabet);", + "source": "boolean isJavaFun = true;\nchar firstAlphabet = 'A'; \n\nIO.println(\"=== Other primitive data types Demo ===\");\nIO.println(\"boolean: \" + isJavaFun);\nIO.println(\"char: \" + firstAlphabet);", "metadata": { "language": "java", + "id": "dff83078-4563-4831-b012-1f5e6c61df5d", "executionSummary": { "executionOrder": 4, "success": true @@ -161,16 +196,16 @@ { "id": "9d083943-839f-4ab1-b652-21d05f1827fe", "cell_type": "code", - "source": "int age = 20;\nboolean hasID = true;\n\nSystem.out.println(\"=== Conditional if-else statement example ===\");\nif (age >= 18) {\n if (hasID) {\n System.out.println(\"You are allowed to enter.\");\n } else {\n System.out.println(\"You need to show your ID.\");\n }\n} else {\n System.out.println(\"You must be 18 or older to enter.\");\n}\n\n\nSystem.out.println(\"=== Conditional switch-case statement example ===\");\nint dayOfWeek = 3;\nString dayName;\n\nswitch (dayOfWeek) {\n case 1 -> dayName = \"Monday\";\n case 2 -> dayName = \"Tuesday\";\n case 3 -> dayName = \"Wednesday\";\n case 4 -> dayName = \"Thursday\";\n case 5 -> dayName = \"Friday\";\n case 6 -> dayName = \"Saturday\";\n case 7 -> dayName = \"Sunday\";\n default -> dayName = \"Invalid day\";\n}\n\nSystem.out.println(\"Day \" + dayOfWeek + \" is: \" + dayName);", + "source": "int age = 20;\nboolean hasID = true;\n\nIO.println(\"=== Conditional if-else statement example ===\");\nif (age >= 18) {\n if (hasID) {\n IO.println(\"You are allowed to enter.\");\n } else {\n IO.println(\"You need to show your ID.\");\n }\n} else {\n IO.println(\"You must be 18 or older to enter.\");\n}\n\n\nIO.println(\"=== Conditional switch-case statement example ===\");\nint dayOfWeek = 3;\nString dayName;\n\nswitch (dayOfWeek) {\n case 1 -> dayName = \"Monday\";\n case 2 -> dayName = \"Tuesday\";\n case 3 -> dayName = \"Wednesday\";\n case 4 -> dayName = \"Thursday\";\n case 5 -> dayName = \"Friday\";\n case 6 -> dayName = \"Saturday\";\n case 7 -> dayName = \"Sunday\";\n default -> dayName = \"Invalid day\";\n}\n\nIO.println(\"Day \" + dayOfWeek + \" is: \" + dayName);", "metadata": { "language": "java", "id": "9d083943-839f-4ab1-b652-21d05f1827fe", "executionSummary": { - "executionOrder": 2, + "executionOrder": 5, "success": true } }, - "execution_count": 2, + "execution_count": 5, "outputs": [ { "output_type": "execute_result", @@ -178,7 +213,7 @@ "text/plain": "=== Conditional if-else statement example ===\nYou are allowed to enter.\n=== Conditional switch-case statement example ===\nDay 3 is: Wednesday\n" }, "metadata": {}, - "execution_count": 2 + "execution_count": 5 } ] }, @@ -203,16 +238,16 @@ { "id": "17fed500-4e81-49b5-9576-99bfd1bdeea7", "cell_type": "code", - "source": "System.out.print(\"Counting 1-5: \");\nfor (int i = 1; i <= 5; i++) {\n System.out.print(i + \" \");\n}\nSystem.out.println();", + "source": "IO.print(\"Counting 1-5: \");\nfor (int i = 1; i <= 5; i++) {\n IO.print(i + \" \");\n}\nIO.println();", "metadata": { "language": "java", "id": "17fed500-4e81-49b5-9576-99bfd1bdeea7", "executionSummary": { - "executionOrder": 3, + "executionOrder": 6, "success": true } }, - "execution_count": 3, + "execution_count": 6, "outputs": [ { "output_type": "execute_result", @@ -220,7 +255,7 @@ "text/plain": "Counting 1-5: 1 2 3 4 5 \n" }, "metadata": {}, - "execution_count": 3 + "execution_count": 6 } ] }, @@ -236,16 +271,16 @@ { "id": "f7135abb-43e7-4eb7-aa45-4f91f8dd485d", "cell_type": "code", - "source": "int countdown = 5;\nSystem.out.print(\"Countdown: \");\nwhile (countdown > 0) {\n System.out.print(countdown + \" \");\n countdown--;\n}\nSystem.out.println(\"Countdown completed!\");", + "source": "int countdown = 5;\nIO.print(\"Countdown: \");\nwhile (countdown > 0) {\n IO.print(countdown + \" \");\n countdown--;\n}\nIO.println(\"Countdown completed!\");", "metadata": { "language": "java", "id": "f7135abb-43e7-4eb7-aa45-4f91f8dd485d", "executionSummary": { - "executionOrder": 4, + "executionOrder": 7, "success": true } }, - "execution_count": 4, + "execution_count": 7, "outputs": [ { "output_type": "execute_result", @@ -253,7 +288,7 @@ "text/plain": "Countdown: 5 4 3 2 1 Countdown completed!\n" }, "metadata": {}, - "execution_count": 4 + "execution_count": 7 } ] }, @@ -269,24 +304,24 @@ { "id": "3b0d4c9f-b0d2-4e98-bb47-3af51693e0ba", "cell_type": "code", - "source": "int[] numbers = {10, 20, 30, 40, 50};\nSystem.out.print(\"Array elements: \");\nfor (int num : numbers) {\n System.out.print(num + \" \");\n}", + "source": "var numbers = List.of(10, 20, 30, 40, 50);\nIO.print(\"List elements: \");\nfor (var num : numbers) {\n IO.print(num + \" \");\n}", "metadata": { "language": "java", "id": "3b0d4c9f-b0d2-4e98-bb47-3af51693e0ba", "executionSummary": { - "executionOrder": 5, + "executionOrder": 8, "success": true } }, - "execution_count": 5, + "execution_count": 8, "outputs": [ { "output_type": "execute_result", "data": { - "text/plain": "Array elements: 10 20 30 40 50 " + "text/plain": "List elements: 10 20 30 40 50 " }, "metadata": {}, - "execution_count": 5 + "execution_count": 8 } ] } diff --git a/samples/notebooks/LearningSample_Java17+.ijnb b/samples/notebooks/LearningSample_Java17+.ijnb new file mode 100644 index 0000000..47365d0 --- /dev/null +++ b/samples/notebooks/LearningSample_Java17+.ijnb @@ -0,0 +1,329 @@ +{ + "nbformat": 4, + "nbformat_minor": 5, + "metadata": { + "language_info": { + "name": "java" + } + }, + "cells": [ + { + "id": "1c4583aa-a137-4e55-915e-5c218bc02744", + "cell_type": "markdown", + "source": "\n***Sample Note:***\n\nThis notebook demonstrates the use of notebooks in helping learners explore some basic concepts of Java with small, self-contained examples.\n\n**What this sample shows:**\n\n- Markdown-formatted guidance with clearly organized sections\n- Running code cells displays output inline\n - Optionally includes saved outputs from prior runs for reference\n\n**Prerequisites:**\n\nThis notebook requires Java 17+ to run all the cells successfully.", + "metadata": { + "language": "markdown", + "id": "1c4583aa-a137-4e55-915e-5c218bc02744" + } + }, + { + "id": "21015b6e-8260-43d6-a629-4e7c2b5d6ff3", + "cell_type": "markdown", + "source": "# Learning Java Basics", + "metadata": { + "language": "markdown", + "id": "21015b6e-8260-43d6-a629-4e7c2b5d6ff3" + } + }, + { + "id": "2ae1546a-0b98-492f-9b0f-2680cef59aa5", + "cell_type": "markdown", + "source": "### Greetings !!\nExecute the below code snippet and enter you name in the input box at the top of the screen ", + "metadata": { + "language": "markdown", + "id": "2ae1546a-0b98-492f-9b0f-2680cef59aa5" + } + }, + { + "id": "49827505-b57d-4827-bdd6-a9ffdf27e80b", + "cell_type": "code", + "source": "Scanner s = new Scanner(System.in);\nSystem.out.println(\"Enter your name:\");\nString name = s.nextLine();\nSystem.out.println(\"Hello \"+name+\" !\");", + "metadata": { + "language": "java", + "id": "49827505-b57d-4827-bdd6-a9ffdf27e80b", + "executionSummary": { + "executionOrder": 1, + "success": true + } + }, + "execution_count": 1, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "Enter your name:\nHello !\n" + }, + "metadata": {}, + "execution_count": 1 + } + ] + }, + { + "id": "98ba9913-0b56-458d-ab0e-0bdad5744159", + "cell_type": "markdown", + "source": "## Lesson-1: Primitive Data Types\n### Learning Objectives:\n- Understand primitive data types in Java\n- Learn variable declaration and initialization\n\n### Key Concepts:\n- **Primitive Types**: byte, short, int, long, float, double, boolean, char\n- **Variable Declaration**: `dataType variableName = value;`\n\nLet's start with basic variable declarations and see how different data types work:", + "metadata": { + "language": "markdown", + "id": "98ba9913-0b56-458d-ab0e-0bdad5744159" + } + }, + { + "id": "d996dd73-556b-4856-9a20-8f54da5615fc", + "cell_type": "markdown", + "source": "#### Primitive Types", + "metadata": { + "language": "markdown", + "id": "d996dd73-556b-4856-9a20-8f54da5615fc" + } + }, + { + "id": "fcad594a-7c8f-42fe-ac06-7415cb734163", + "cell_type": "markdown", + "source": "##### Integer Types\n\n\n\n| Type | Size (bytes) | Range |\n|--------|--------------|-----------------------------|\n| `byte` | 1 | -128 to 127 |\n| `short` | 2 | -32,768 to 32,767 |\n| `int` | 4 | -2³¹ to 2³¹ − 1 |\n| `long` | 8 | -2⁶³ to 2⁶³ − 1 |\n\n\n", + "metadata": { + "language": "markdown", + "id": "fcad594a-7c8f-42fe-ac06-7415cb734163" + } + }, + { + "id": "d5dcf964-eeb5-4966-9ac6-58352b3606a8", + "cell_type": "code", + "source": "byte smallNumber = 127;\nshort mediumNumber = 32000;\nint regularNumber = 2147483647; \nlong bigNumber = 9223372036854775807L;\n\nSystem.out.println(\"=== Integer data types Demo ===\");\nSystem.out.println(\"byte: \" + smallNumber);\nSystem.out.println(\"short: \" + mediumNumber);\nSystem.out.println(\"int: \" + regularNumber);\nSystem.out.println(\"long: \" + bigNumber);", + "metadata": { + "language": "java", + "id": "d5dcf964-eeb5-4966-9ac6-58352b3606a8", + "executionSummary": { + "executionOrder": 2, + "success": true + } + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "=== Integer data types Demo ===\nbyte: 127\nshort: 32000\nint: 2147483647\nlong: 9223372036854775807\n" + }, + "metadata": {}, + "execution_count": 2 + } + ] + }, + { + "id": "a8d96d05-5a00-4322-91ca-aa2878e8c757", + "cell_type": "markdown", + "source": "##### Floating-Point Types\n\n\n\n| Type | Size (bytes) | Range |\n|----------|-------------|------------------------|\n| `float` | 4 | ~6-7 significant decimal digits |\n| `double` | 8 | ~15-16 significant decimal digits |\n\n", + "metadata": { + "language": "markdown", + "id": "a8d96d05-5a00-4322-91ca-aa2878e8c757" + } + }, + { + "id": "71fbbad5-54d6-4d7a-8840-2101f61ca0a4", + "cell_type": "code", + "source": "\nfloat decimal1 = 3.14f;\ndouble decimal2 = 3.141592653589793;\n\nSystem.out.println(\"=== Floating point data types Demo ===\");\nSystem.out.println(\"float: \" + decimal1);\nSystem.out.println(\"double: \" + decimal2);\n", + "metadata": { + "language": "java", + "id": "71fbbad5-54d6-4d7a-8840-2101f61ca0a4", + "executionSummary": { + "executionOrder": 3, + "success": true + } + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "=== Floating point data types Demo ===\nfloat: 3.14\ndouble: 3.141592653589793\n" + }, + "metadata": {}, + "execution_count": 3 + } + ] + }, + { + "id": "65548da3-5558-4683-97ac-5cdd341001a3", + "cell_type": "markdown", + "source": "##### Other primitive Types\n\n\n\n| Type | Size (bytes) | Range |\n|-----------|--------------|------------------------|\n| `char` | 2 | (Unicode Values) `\\u0000` (0) to `\\uFFFF` (65,535) |\n| `boolean` | JVM-dependent (typically 1 byte) | `true`, `false` |\n\n", + "metadata": { + "language": "markdown", + "id": "65548da3-5558-4683-97ac-5cdd341001a3" + } + }, + { + "id": "dff83078-4563-4831-b012-1f5e6c61df5d", + "cell_type": "code", + "source": "boolean isJavaFun = true;\nchar firstAlphabet = 'A'; \n\nSystem.out.println(\"=== Other primitive data types Demo ===\");\nSystem.out.println(\"boolean: \" + isJavaFun);\nSystem.out.println(\"char: \" + firstAlphabet);", + "metadata": { + "language": "java", + "id": "dff83078-4563-4831-b012-1f5e6c61df5d", + "executionSummary": { + "executionOrder": 4, + "success": true + } + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "=== Other primitive data types Demo ===\nboolean: true\nchar: A\n" + }, + "metadata": {}, + "execution_count": 4 + } + ] + }, + { + "id": "686ef654-eae5-450f-82d3-716c1844a09d", + "cell_type": "markdown", + "source": "## Lesson 2: Control Structures\n\n### Learning Objectives:\n- Master conditional statements (if-else, switch)\n- Understand different types of loops (for, while, do-while)\n- Learn when to use each control structure\n- Practice nested structures and loop control\n\n### Key Concepts:\n- **Conditional Logic**: Making decisions in code\n- **Loops**: Repeating code blocks efficiently\n- **Loop Control**: break, continue statements\n- **Best Practices**: Choosing the right structure for the task", + "metadata": { + "language": "markdown", + "id": "686ef654-eae5-450f-82d3-716c1844a09d" + } + }, + { + "id": "28fe4501-0c0e-4f10-ba51-521464c6f6f1", + "cell_type": "markdown", + "source": "#### Conditional Logic\nExplore `if-else` and `switch` expresssions below.", + "metadata": { + "language": "markdown", + "id": "28fe4501-0c0e-4f10-ba51-521464c6f6f1" + } + }, + { + "id": "9d083943-839f-4ab1-b652-21d05f1827fe", + "cell_type": "code", + "source": "int age = 20;\nboolean hasID = true;\n\nSystem.out.println(\"=== Conditional if-else statement example ===\");\nif (age >= 18) {\n if (hasID) {\n System.out.println(\"You are allowed to enter.\");\n } else {\n System.out.println(\"You need to show your ID.\");\n }\n} else {\n System.out.println(\"You must be 18 or older to enter.\");\n}\n\n\nSystem.out.println(\"=== Conditional switch-case statement example ===\");\nint dayOfWeek = 3;\nString dayName;\n\nswitch (dayOfWeek) {\n case 1 -> dayName = \"Monday\";\n case 2 -> dayName = \"Tuesday\";\n case 3 -> dayName = \"Wednesday\";\n case 4 -> dayName = \"Thursday\";\n case 5 -> dayName = \"Friday\";\n case 6 -> dayName = \"Saturday\";\n case 7 -> dayName = \"Sunday\";\n default -> dayName = \"Invalid day\";\n}\n\nSystem.out.println(\"Day \" + dayOfWeek + \" is: \" + dayName);", + "metadata": { + "language": "java", + "id": "9d083943-839f-4ab1-b652-21d05f1827fe", + "executionSummary": { + "executionOrder": 5, + "success": true + } + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "=== Conditional if-else statement example ===\nYou are allowed to enter.\n=== Conditional switch-case statement example ===\nDay 3 is: Wednesday\n" + }, + "metadata": {}, + "execution_count": 5 + } + ] + }, + { + "id": "325f07b7-e35c-440b-ae36-066d3c74d3f4", + "cell_type": "markdown", + "source": "#### Loops\nExplore different kinds of loops, using statements such as `for`, `enhanced-for` and `while` below.", + "metadata": { + "language": "markdown", + "id": "325f07b7-e35c-440b-ae36-066d3c74d3f4" + } + }, + { + "id": "03405940-5dc9-4569-8f69-a320bebb1ffe", + "cell_type": "markdown", + "source": "##### `for` loop - counting", + "metadata": { + "language": "markdown", + "id": "03405940-5dc9-4569-8f69-a320bebb1ffe" + } + }, + { + "id": "17fed500-4e81-49b5-9576-99bfd1bdeea7", + "cell_type": "code", + "source": "System.out.print(\"Counting 1-5: \");\nfor (int i = 1; i <= 5; i++) {\n System.out.print(i + \" \");\n}\nSystem.out.println();", + "metadata": { + "language": "java", + "id": "17fed500-4e81-49b5-9576-99bfd1bdeea7", + "executionSummary": { + "executionOrder": 6, + "success": true + } + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "Counting 1-5: 1 2 3 4 5 \n" + }, + "metadata": {}, + "execution_count": 6 + } + ] + }, + { + "id": "1272027a-b7d6-4db8-84da-0a97a5510f44", + "cell_type": "markdown", + "source": "##### `while` loop - with condition", + "metadata": { + "language": "markdown", + "id": "1272027a-b7d6-4db8-84da-0a97a5510f44" + } + }, + { + "id": "f7135abb-43e7-4eb7-aa45-4f91f8dd485d", + "cell_type": "code", + "source": "int countdown = 5;\nSystem.out.print(\"Countdown: \");\nwhile (countdown > 0) {\n System.out.print(countdown + \" \");\n countdown--;\n}\nSystem.out.println(\"Countdown completed!\");", + "metadata": { + "language": "java", + "id": "f7135abb-43e7-4eb7-aa45-4f91f8dd485d", + "executionSummary": { + "executionOrder": 7, + "success": true + } + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "Countdown: 5 4 3 2 1 Countdown completed!\n" + }, + "metadata": {}, + "execution_count": 7 + } + ] + }, + { + "id": "e5ab8d0b-dfd0-4d5e-a7f6-b9eee6be9bee", + "cell_type": "markdown", + "source": "##### Enhanced `for` loop with array", + "metadata": { + "language": "markdown", + "id": "e5ab8d0b-dfd0-4d5e-a7f6-b9eee6be9bee" + } + }, + { + "id": "3b0d4c9f-b0d2-4e98-bb47-3af51693e0ba", + "cell_type": "code", + "source": "var numbers = List.of(10, 20, 30, 40, 50);\nSystem.out.print(\"Array elements: \");\nfor (var num : numbers) {\n System.out.print(num + \" \");\n}", + "metadata": { + "language": "java", + "id": "3b0d4c9f-b0d2-4e98-bb47-3af51693e0ba", + "executionSummary": { + "executionOrder": 8, + "success": true + } + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "Array elements: 10 20 30 40 50 " + }, + "metadata": {}, + "execution_count": 8 + } + ] + } + ] +} \ No newline at end of file