From 63581ec967909d8654d12fed0c179c1c14ff8ab9 Mon Sep 17 00:00:00 2001 From: Coder Shiyar Date: Sat, 5 Mar 2022 21:21:12 +0100 Subject: [PATCH] Update , lesson 16 files are added --- .../App.java" | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 "Lesson 16 - \330\247\331\204\330\257\330\261\330\263/App.java" diff --git "a/Lesson 16 - \330\247\331\204\330\257\330\261\330\263/App.java" "b/Lesson 16 - \330\247\331\204\330\257\330\261\330\263/App.java" new file mode 100644 index 0000000..c86ed19 --- /dev/null +++ "b/Lesson 16 - \330\247\331\204\330\257\330\261\330\263/App.java" @@ -0,0 +1,52 @@ +import java.util.Scanner; + +public class App { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + System.out.println("Enter 1 for Arabic , 2 for English , 3 For Dutch"); + int option = scanner.nextInt(); + switch(option){ + case 1: + System.out.println("مرحبا"); + break; + case 2: + System.out.println("Hello"); + break; + case 3: + System.out.println("Hoi"); + break; + default: + System.out.println("Error"); + } + + if(option == 1){ + System.out.println("مرحبا"); + }else if(option == 2){ + System.out.println("Hello"); + }else if(option == 3){ + System.out.println("Hoi"); + }else{ + System.out.println("Error"); + } + + } +} + +// Java Switch Statements +// --------------------------------------------------------------------------------------------- +// Use the switch statement to select one of many code blocks to be executed. +// استخدم جملة سويتش لتحديد واحدة من العديد من مجموعات التعليمات البرمجية ليتم تنفيذها +// --------------------------------------------------------------------------------------------- +// switch(expression) { +// case a: +// // code block +// break; +// case b: +// // code block +// break; +// default: +// // code block +// } +// --------------------------------------------------------------------------------------------- +// The default keyword specifies some code to run if there is no case match +// ---------------------------------------------------------------------------------------------