بطبط

رجع لباقي المحاضرات
محاضرة 2

Operators, Conditionals, and Loops

العمليات الحسابية، جمل التحكم، والحلقات التكرارية في Java.

يلا نشوف الملخص

📖 Lecture 2: Type Casting, Operators, and Conditions

  • Type Casting: Converting one primitive data type into another [4].
    • Widening Casting (Automatic): Converting a smaller type to a larger type (e.g., int to double) [4].
    • Narrowing Casting (Manual): Converting a larger type to a smaller type by placing the target type in parentheses (e.g., (int) 9.78), which truncates the decimal [5].
  • Operators: Java includes Arithmetic operators (+, -, *, /, %, ++, --) [6] and Assignment operators (like =, +=) [6].
  • Conditional Statements:
    • if and else blocks execute code based on a true/false condition [7]. Nested conditions allow placing if statements inside other if statements [7].
    • Ternary Operator: A shorthand for if-else written as variable = (condition) ? expressionTrue : expressionFalse; [8].
    • Switch Statement: Evaluates a single variable against multiple case values [9]. It uses break to stop execution and default for unmatched cases [9].
  • User Input: The Scanner class (from java.util.Scanner) is used to read inputs like nextInt() and nextDouble() [10, 11].

في نقطة مش واضحة؟ بطبط موجود!

اسأل بطبط عنها
بطبط
</>تم التصميم والتنفيذ بقسم تكنولوجيا المعلومات
تحت إدارة وإشراف

جامعة برج العرب التكنولوجية

جميع الحقوق محفوظة © BATBAT 2026