انتقل إلى المحتوى
أمين أبوزيد
BEG-007

كيف يُنفَّذ الكود

  • 5 درس
  • 57 دقيقة قراءة
  • 1.5 ساعة تدريب (تقدير)
في هذه الصفحة 8 موضوعات

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

نظرة عامة

الموضوعات

  • الكود المصدري، الترجمة، الشيفرة الوسيطة (bytecode)، التنفيذ، أخطاء وقت التشغيل
  • مترجم Java وJVM وJRE وJDK

تعلّم أولًا

57 دقيقة قراءة · 1.5 ساعة تدريب (تقدير)

مخرجات التعلم

  1. Explain the difference between source code, bytecode, and machine code.
  2. Distinguish JDK, JRE, and JVM and say which one a developer needs.
  3. Compile a .java file with javac and run the resulting class with java from the terminal.
  4. Distinguish a compile-time error from a runtime error, given an example of each.

الدروس

  1. 01من النص إلى التنفيذ: المترجمات والمفسّرات12 د قراءة
  2. 02أسلوب Java: الشيفرة الوسيطة (bytecode) وJVM11 د قراءة
  3. 03JDK مقابل JRE مقابل JVM10 د قراءة
  4. 04الترجمة والتشغيل من الطرفية12 د قراءة
  5. 05عرض عملي: ترجمة Hello World وتشغيله وتعطيله وإصلاحه في الطرفية12 د قراءة

المختبر والتمارين

Lab

BEG-007-LAB1 · Hello from the terminal

Outcomes: 1–4 · Time: ~1.5 h

  1. Type the provided Hello program, compile it with javac, and run it with java.
  2. Look at the generated .class file.
  3. Introduce a syntax error and record the compile-time message.
  4. Introduce a division-by-zero error and record the runtime message.
  5. Run the same program in IntelliJ.

Acceptance: both messages captured and each classified correctly.

Exercises

IDOutcomeTask
BEG-007-EX011Put in order: machine code, source code, bytecode.
BEG-007-EX021Why can the same .class file run on Windows and Linux?
BEG-007-EX032Draw JDK, JRE, and JVM as nested boxes.
BEG-007-EX042Which one do you install to write Java, and why?
BEG-007-EX053Compile and run a program from the terminal; list the two commands.
BEG-007-EX063java Hello.class fails. Why, and what is the fix?
BEG-007-EX074Classify: a missing semicolon; dividing by zero; a typo in a variable name.
أظهر الحلول
  • EX01 Source code → bytecode → machine code.
  • EX02 Each OS has a JVM that runs the same bytecode.
  • EX03 JVM inside JRE inside JDK.
  • EX04 The JDK, because it includes the compiler.
  • EX05 javac Hello.java then java Hello.
  • EX06 java expects the class name, not the file name. Use java Hello.
  • EX07 Compile-time; runtime; compile-time.

الاختبار

Outcomes: O1 source/bytecode/machine code · O2 JDK/JRE/JVM · O3 compile and run · O4 error kinds.

اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.

  1. 1The CPU directly runs:O1
  2. 2javac turns .java into:O1
  3. 3A compiler translates:O1
  4. 4Which runs bytecode?O2
  5. 5Which includes the compiler?O2
  6. 6A developer should install the:O2
  7. 7To run class Hello you type:O3
  8. 8javac Hello.java requires:O3
  9. 9A missing semicolon is a:O4
  10. 10Dividing by zero while running is a:O4

الجزء العملي

Explain the compile/run pipeline aloud while demonstrating it: write, javac, show .class, java. Pass: all four steps and the name of each file involved.

أخطاء شائعة

Class name not matching file name; running java Hello.class; confusing "it compiled" with "it works".

التقييم

Explain the compile/run pipeline aloud while demonstrating it.

الصلة بالمسار الوظيفي

Basis for build tools (BEG-054) and JVM internals (MID-001).

اكتب للبحث في المستويات والمراحل والوحدات والدروس.