נבנה על ידיBuilt by Ariel Yohimovich

JavaJava
12
חלקPart 2: מתודות ומערכיםMethods & arrays כ-3 שעות (כולל הפסקה)About 3 hours (with a break)

חריגות בסיסיותBasic exceptions

מה זו חריגה, try, catch ו-finally, זריקה עם throw, והודעות שגיאה שעוזרות.

What an exception is, try, catch and finally, throwing with throw, and error messages that help.

בסוף המפגש תדעוBy the end you will

  • להבין מה זו חריגה ומה קורה כשאף אחד לא תופס אותהUnderstand what an exception is and what happens when nobody catches it
  • לתפוס חריגה עם try ו-catch, ולהמשיך לרוץCatch an exception with try and catch, and keep running
  • להשתמש ב-finally לקוד שחייב לרוץ בכל מקרהUse finally for code that must run in any case
  • לזרוק חריגה בעצמכם עם throw והודעה שעוזרת להבין מה לא תקיןThrow an exception yourself with throw and a message that helps
להתחיל בהרצאהStart the lecture

לפני שמתחיליםBefore you start

זמן: Time: כ-3 שעות (כולל הפסקה)About 3 hours (with a break)

דרישות קודמות: Prerequisites: מפגשים 1–11Sessions 1–11

מה צריך: You need: מחשב עם JDK 21 ו-IntelliJ IDEA מותקנים (מפגש 1). אפשר גם רק דפדפן: כל הקוד מוצג עם הפלט האמיתי שלו, ורץ גם כאן כשהדפדפן מאפשר.A computer with JDK 21 and IntelliJ IDEA (session 1). A browser alone also works: every example shows its real output, and runs here when the browser allows it.

סדר המפגשSession plan

  1. 0:00פתיחה וחזרה קצרהOpening and quick review
  2. 0:10מונחיםTerms
  3. 0:27חריגה שאף אחד לא תופסAn exception nobody catches
  4. 0:44try ו-catch: ממשיכים לרוץtry and catch: keep running
  5. 1:01finally רץ תמידfinally always runs
  6. 1:18הפסקהBreak
  7. 1:28throw: אתם מחליטים מה לא חוקיthrow: you decide what's illegal
  8. 1:45טעויות נפוצותCommon mistakes
  9. 2:02פרויקט מדףShelf project
  10. 2:19תרגולPractice
  11. 2:50סיכום ושאלותWrap-up and questions

מה זו חריגה, try, catch ו-finally, זריקה עם throw, והודעות שגיאה שעוזרות. בסוף המפגש מוסיפים צעד לפרויקט המלווה.

What an exception is, try, catch and finally, throwing with throw, and error messages that help. At the end we add a step to the companion project.

הפרויקט המלווהThe companion project: מדף: ספרייה אישיתShelf: a personal library

פרויקט אחד שגדל איתכם לאורך כל הקורס: מתחיל כתוכנית של 10 שורות, הופך למחלקות, ל-interfaces ול-streams, מייבא ספרים במקביל עם Threads, ונגמר כ-REST API.

One project that grows with you through the whole course: it starts as a 10-line program, becomes classes, interfaces and streams, imports books in parallel with threads, and ends as a REST API.

השלב של היוםToday's step קלט עמיד: שנה לא חוקית לא מפילה את המדףRobust input: a bad year doesn't crash the shelf. לתרגילGo to the exercise

מונחים חדשים במפגשNew terms in this session

נבנה על ידיBuilt by Ariel Yohimovich