מילון מונחיםGlossary
כל מונח שמופיע בקורס, מוסבר במילים פשוטות. לכל מונח יש קישור ישיר (עוגן), ומכל מקום בקורס אפשר לקפוץ לכאן.
Every term in the course, explained in plain words. Each term has a direct link (anchor) you can jump to from anywhere in the course.
298 מונחים עד עכשיוterms so farכל המונחיםAll terms
@Override@Override@Override@Override
מבקש מ-javac לוודא שאתם באמת דורסים מתודה קיימת. אם החתימה שגויה (למשל equals(Book)), javac עוצר: method does not override or implement a method from a supertype.
Asks javac to make sure you really override an existing method. With a wrong signature (e.g. equals(Book)), javac stops: method does not override or implement a method from a supertype.
AABBAABBAABBAABB
התנגשות בין שני מלבנים ישרים: הם חופפים אם הם חופפים גם בציר x וגם בציר y. Rectangle.intersects עושה בדיוק את זה.
A collision between two upright rectangles: they overlap if they overlap on both the x axis and the y axis. Rectangle.intersects does exactly that.
ArrayDequeArrayDequeArrayDequeArrayDeque
תור דו-כיווני מהיר. כתור: offer ו-poll (ראשון נכנס, ראשון יוצא). כמחסנית: push ו-pop (אחרון נכנס, ראשון יוצא).
A fast double-ended queue. As a queue: offer and poll (first in, first out). As a stack: push and pop (last in, first out).
ArrayIndexOutOfBoundsExceptionArrayIndexOutOfBoundsExceptionArrayIndexOutOfBoundsExceptionArrayIndexOutOfBoundsException
החריגה כשפונים לתא שלא קיים: Index 5 out of bounds for length 3.
The exception for a cell that doesn't exist: Index 5 out of bounds for length 3.
ArrayListArrayListArrayListArrayList
רשימה שגדלה לבד: List<String> l = new ArrayList<>();, l.add(x), l.get(i), l.size().
A list that grows by itself: List<String> l = new ArrayList<>();, l.add(x), l.get(i), l.size().
assertassertionassertionassert
assertEquals(expected, actual), assertTrue, assertThrows(Type.class, () -> ...): אם הבדיקה נכשלת, JUnit מסמן FAIL ומראה מה היה צפוי ומה התקבל.
assertEquals(expected, actual), assertTrue, assertThrows(Type.class, () -> ...): when one fails, JUnit marks FAIL and shows what was expected and what came.
AtomicAtomicAtomicAtomic
AtomicInteger, AtomicLong ודומיהם: incrementAndGet() ו-addAndGet() הם צעד אחד שאי אפשר לחתוך, בלי מנעול.
AtomicInteger, AtomicLong and friends: incrementAndGet() and addAndGet() are one step nobody can cut into, with no lock.
autoboxingautoboxingautoboxingautoboxing
Java הופכת לבד int ל-Integer כשמכניסים לאוסף, ובחזרה כשמוציאים.
Java turns an int into an Integer by itself when you put it in a collection, and back when you take it out.
BFSBFSBFSBFS
חיפוש לרוחב: עוברים על גרף שכבה אחרי שכבה בעזרת תור. מוצא את המסלול הקצר ביותר (במספר צעדים).
Breadth-first search: walk a graph layer by layer with a queue. Finds the shortest path (in number of steps).
מופיע לראשונה: First appears: מפגשSession 42BlockingQueueBlockingQueueBlockingQueueBlockingQueue
תור בטוח ל-threads: put מחכה כשהוא מלא, take מחכה כשהוא ריק. ArrayBlockingQueue (גודל קבוע), LinkedBlockingQueue.
A thread-safe queue: put waits when it's full, take waits when it's empty. ArrayBlockingQueue (fixed size), LinkedBlockingQueue.
broad phasebroad phasebroad phasebroad phase
שלב סינון לפני בדיקת התנגשות מדויקת: מחלקים את העולם לתאים ובודקים רק עצמים באותו תא, במקום כל זוג.
A filtering step before exact collision checks: split the world into cells and check only objects in the same cell, instead of every pair.
מופיע לראשונה: First appears: מפגשSession 45BuilderBuilderBuilderBuilder
בונים עצם צעד אחרי צעד: new Book.Builder("Dune").year(1965).build(). נוח כשיש הרבה שדות אופציונליים, במקום בנאים עם עשרה פרמטרים.
Build an object step by step: new Book.Builder("Dune").year(1965).build(). Handy with many optional fields, instead of constructors with ten parameters.
bytecodebytecodebytecodebytecode
השפה שה-JVM מבינה: הוראות פשוטות שנשמרות בקבצי .class. אותו bytecode רץ בכל מחשב שיש בו JVM.
The language the JVM understands: simple instructions stored in .class files. The same bytecode runs on any computer with a JVM.
מופיע לראשונה: First appears: מפגשSession 1CallableCallableCallableCallable
כמו Runnable, אבל מחזיר ערך ויכול לזרוק חריגה: Callable<Integer> job = () -> 42;.
Like Runnable, but returns a value and may throw: Callable<Integer> job = () -> 42;.
ClassCastExceptionClassCastExceptionClassCastExceptionClassCastException
החריגה כשממירים עצם לטיפוס שהוא לא: class Dvd cannot be cast to class EBook. בודקים קודם עם instanceof.
The exception when you cast an object to a type it isn't: class Dvd cannot be cast to class EBook. Check first with instanceof.
CollectorsCollectorsCollectorsCollectors
מתכונים ל-collect: groupingBy (מפה לפי מפתח), counting, mapping, joining, partitioningBy, toMap.
Recipes for collect: groupingBy (a map by key), counting, mapping, joining, partitioningBy, toMap.
commitcommitcommitcommit
git add בוחר מה ייכנס, ו-git commit -m "..." שומר תמונת מצב. הודעה טובה אומרת מה השתנה ולמה.
git add picks what goes in, and git commit -m "..." saves a snapshot. A good message says what changed and why.
ComparableComparableComparableComparable
Comparable<T> מגדיר "סדר טבעי": compareTo מחזיר מספר שלילי, 0 או חיובי. Arrays.sort ו-Collections.sort משתמשים בו.
Comparable<T> defines a "natural order": compareTo returns a negative number, 0 or a positive one. Arrays.sort and Collections.sort use it.
Comparator.comparingComparator.comparingComparator.comparingComparator.comparing
בונה Comparator ממפתח: Comparator.comparing(Book::year), ואפשר לשרשר .reversed() ו-.thenComparing(...).
Builds a Comparator from a key: Comparator.comparing(Book::year), chaining .reversed() and .thenComparing(...).
compareAndSetcompareAndSetcompareAndSetcompareAndSet
x.compareAndSet(expected, next): משנה רק אם הערך עדיין expected, ומחזיר אם הצליח. בלולאה: קוראים, מחשבים, ומנסים שוב אם מישהו הקדים.
x.compareAndSet(expected, next): changes only if the value is still expected, and returns whether it worked. In a loop: read, compute, and retry if someone got there first.
CompletableFutureCompletableFutureCompletableFutureCompletableFuture
Future שאפשר לשרשר: supplyAsync מתחיל משימה, thenApply ממיר את התוצאה, thenCombine מחבר שתיים, thenCompose משרשר משימה אסינכרונית נוספת, ו-join() מחכה.
A Future you can chain: supplyAsync starts a task, thenApply transforms the result, thenCombine joins two, thenCompose chains another async task, and join() waits.
ConcurrentHashMapConcurrentHashMapConcurrentHashMapConcurrentHashMap
Map בטוח ל-threads בלי לנעול את כולו. merge, compute ו-computeIfAbsent אטומיים; get ואז put לא.
A thread-safe Map that doesn't lock all of itself. merge, compute and computeIfAbsent are atomic; get then put isn't.
cooldowncooldowncooldowncooldown
זמן המתנה אחרי פעולה (כמו ירייה) לפני שמותר שוב. סופרים אותו אחורה עם dt.
A wait after an action (like a shot) before it's allowed again. Count it down with dt.
CSVCSVCSVCSV
קובץ טקסט שבו כל שורה היא רשומה ושדות מופרדים בפסיק (או ;). פשוט, אבל צריך להיזהר מפסיק בתוך שדה.
A text file where each line is a record and fields are separated by a comma (or ;). Simple, but watch out for a comma inside a field.
deadlockdeadlockdeadlockdeadlock
שני threads (או יותר) שכל אחד מחזיק משהו שהשני צריך, ומחכה לו. אף אחד לא יתקדם לעולם, והתוכנית "קופאת" בלי שגיאה.
Two (or more) threads each holding something the other needs, and waiting for it. Nobody will ever move, and the program "freezes" with no error.
מופיע לראשונה: First appears: מפגשSession 38delta timedelta timedelta timedelta time
הזמן (בשניות) מאז הפריים הקודם. זזים speed * dt, כך שבמחשב איטי (פחות פריימים) כל צעד גדול יותר, והמרחק בשנייה זהה.
The time (in seconds) since the previous frame. Move speed * dt, so on a slow computer (fewer frames) each step is bigger, and the distance per second is the same.
double bufferingdouble bufferingdouble bufferingdouble buffering
שני חוצצים: מציירים על האחורי, ואז מחליפים. המסך לא מראה אף פעם פריים חצי מצויר.
Two buffers: draw on the back one, then swap. The screen never shows a half-drawn frame.
מופיע לראשונה: First appears: מפגשSession 47dynamic dispatchdynamic dispatchdynamic dispatchdynamic dispatch
בזמן ריצה, Java בוחרת את הגרסה של המתודה לפי הסוג האמיתי של העצם, לא לפי סוג המשתנה.
At run time, Java picks the method version by the object's real type, not the variable's type.
מופיע לראשונה: First appears: מפגשSession 21effectively finaleffectively finaleffectively finaleffectively final
למבדה יכולה להשתמש במשתנה מקומי מבחוץ רק אם הוא לא משתנה אחרי שנקבע. אחרת javac עוצר.
A lambda can use an outside local variable only if it never changes after it's set. Otherwise javac stops.
מופיע לראשונה: First appears: מפגשSession 26enumenumenumenum
טיפוס עם רשימה סגורה של ערכים: enum Genre { NOVEL, SCIFI }. כל ערך הוא עצם יחיד, ואפשר להשוות עם ==. יכולים להיות לו שדות ומתודות.
A type with a closed list of values: enum Genre { NOVEL, SCIFI }. Each value is a single object, compared with ==. It can have fields and methods.
equalsequalsequalsequals
מתודה של Object שאומרת אם שני עצמים "שווים בתוכן". בלי לדרוס אותה היא בודקת == (אותו עצם). חתימה נכונה: public boolean equals(Object o).
An Object method saying whether two objects are "equal in content". Unless overridden it checks == (the same object). The right signature: public boolean equals(Object o).
Event Dispatch ThreadEvent Dispatch ThreadEvent Dispatch ThreadEvent Dispatch Thread
ה-thread היחיד שמותר לו לגעת ברכיבי Swing. javax.swing.Timer רץ עליו, ולכן משחק פשוט עם Timer לא צריך סנכרון בכלל.
The only thread allowed to touch Swing components. javax.swing.Timer runs on it, so a simple game with a Timer needs no synchronization at all.
ExecutorServiceExecutorServiceExecutorServiceExecutorService
שירות שמקבל משימות (submit) ומריץ אותן על threads שהוא מנהל. נוצר עם Executors.newFixedThreadPool(n) ודומיו.
A service that takes tasks (submit) and runs them on threads it manages. Created with Executors.newFixedThreadPool(n) and friends.
FactoryFactoryFactoryFactory
מתודה (או מחלקה) שמחליטה איזה עצם ליצור לפי קלט, כך שהשאר לא תלוי במחלקות הקונקרטיות.
A method (or class) deciding which object to create from some input, so the rest doesn't depend on the concrete classes.
מופיע לראשונה: First appears: מפגשSession 24FilesFilesFilesFiles
מחלקת עזר עם כל הפעולות: writeString, readString, write, readAllLines, lines, exists, size, createDirectories, list, delete. רובן זורקות IOException (checked).
A utility class with all the operations: writeString, readString, write, readAllLines, lines, exists, size, createDirectories, list, delete. Most throw IOException (checked).
finalfinalfinalfinal
משתנה final מקבל ערך פעם אחת ולא משתנה יותר. קבועים כותבים באותיות גדולות: final int MAX = 10;.
A final variable gets a value once and never changes. Constants are written in capitals: final int MAX = 10;.
finallyfinallyfinallyfinally
בלוק שרץ אחרי try/catch תמיד: גם כשהכול עבר, גם כשנתפסה חריגה, ואפילו כשיש return. מתאים לסגירת משאבים.
A block that runs after try/catch always: when all went well, when an exception was caught, even with a return. Good for closing resources.
for-eachfor-eachfor-eachfor-each
for (char c : s.toCharArray()): עובר על כל פריט, בלי מונה.
for (char c : s.toCharArray()): goes over every item, with no counter.
functional interfacefunctional interfacefunctional interfacefunctional interface
interface עם מתודה מופשטת אחת בדיוק (כמו Comparator, Runnable, Predicate). כל למבדה "נכנסת" לתוך interface כזה. @FunctionalInterface מבקש מ-javac לבדוק.
An interface with exactly one abstract method (like Comparator, Runnable, Predicate). Every lambda "fits into" such an interface. @FunctionalInterface asks javac to check.
FutureFutureFutureFuture
"קבלה" על תוצאה שעוד תגיע. get() מחכה לה; אם המשימה נכשלה, get() זורק ExecutionException שהחריגה המקורית היא ה-cause שלה.
A "receipt" for a result still to come. get() waits for it; if the task failed, get() throws an ExecutionException whose cause is the original exception.
getter ו-settergetter and settergetter and settergetter ו-setter
getRating() מחזירה ערך, ו-setRating(int) משנה אותו (עם בדיקה). לא לכל שדה צריך setter: רק למה שבאמת אמור להשתנות.
getRating() returns a value, and setRating(int) changes it (with a check). Not every field needs a setter: only what really should change.
GitGitGitGit
מערכת שמירת גרסאות: כל commit הוא תמונת מצב של הפרויקט עם הודעה. אפשר לחזור אחורה, לפתוח ענפים (branches) ולמזג. GitHub שומר עותק ברשת.
A version-control system: each commit is a snapshot of the project with a message. You can go back, open branches and merge. GitHub keeps a copy online.
GradleGradleGradleGradle
כלי בנייה נוסף, עם build.gradle במקום pom.xml. אותו מבנה תיקיות. gradle test, gradle build.
Another build tool, with build.gradle instead of pom.xml. The same folder layout. gradle test, gradle build.
Graphics2DGraphics2DGraphics2DGraphics2D
"מכחול" של Java: setColor, fillRect, fillOval, drawString. ראשית הצירים בפינה השמאלית העליונה, ו-y גדל כלפי מטה.
Java's "brush": setColor, fillRect, fillOval, drawString. The origin is the top-left corner, and y grows downward.
happens-beforehappens-beforehappens-beforehappens-before
כלל ב-Java שמבטיח שכתיבה נראית לקריאה: start() לפני כל מה שה-thread עושה, כל מה שה-thread עשה לפני join(), כתיבה ל-volatile לפני קריאה שלו, ושחרור מנעול לפני הנעילה הבאה.
A Java rule guaranteeing a write is visible to a read: start() before everything the thread does, everything the thread did before join(), a volatile write before its read, and an unlock before the next lock.
hashCodehashCodehashCodehashCode
מספר שמחושב מהתוכן של העצם. HashSet ו-HashMap משתמשים בו כדי למצוא "מגירה" לפני שהם קוראים ל-equals. Objects.hash(a, b) מחשב אותו בקלות.
A number computed from the object's content. HashSet and HashMap use it to find a "drawer" before calling equals. Objects.hash(a, b) computes it easily.
HashMapHashMapHashMapHashMap
מילון של מפתח וערך: Map<String, Integer> m = new HashMap<>();, m.put(k, v), m.get(k). הסדר לא מובטח.
A key-value map: Map<String, Integer> m = new HashMap<>();, m.put(k, v), m.get(k). The order isn't guaranteed.
headlessheadlessheadlessheadless
הרצה בלי מסך. Java יכולה לצייר על BufferedImage ולשמור PNG גם בלי חלון: כך נוצרו התמונות באתר.
Running with no screen. Java can draw on a BufferedImage and save a PNG with no window: that's how the pictures on the site were made.
heapheapheapheap
האזור בזיכרון שבו גרים העצמים. המשתנים ב-stack מחזיקים רק חצים (הפניות) אליהם.
The memory area where objects live. Variables on the stack hold only arrows (references) to them.
מופיע לראשונה: First appears: מפגשSession 13HttpClientHttpClientHttpClientHttpClient
HttpClient.newHttpClient() ו-client.send(request, BodyHandlers.ofString()): שולח בקשת HTTP ומחזיר HttpResponse עם statusCode(), headers() ו-body().
HttpClient.newHttpClient() and client.send(request, BodyHandlers.ofString()): sends an HTTP request and returns an HttpResponse with statusCode(), headers() and body().
IllegalArgumentExceptionIllegalArgumentExceptionIllegalArgumentExceptionIllegalArgumentException
החריגה המקובלת כשמתודה מקבלת ערך לא חוקי. ההודעה צריכה לומר מה צפוי ומה התקבל.
The usual exception when a method gets an illegal value. The message should say what was expected and what came in.
מופיע לראשונה: First appears: מפגשSession 12importimportimportimport
שורה בראש הקובץ שמביאה מחלקה מספרייה: import java.util.Scanner;.
A line at the top of the file that brings in a library class: import java.util.Scanner;.
instanceof עם משתנהpattern instanceofpattern instanceofinstanceof עם משתנה
o instanceof Book other בודק את הטיפוס וגם נותן משתנה מוכן מהטיפוס הזה, בלי המרה ידנית (Java 16 ומעלה).
o instanceof Book other checks the type and gives a ready variable of that type, with no manual cast (Java 16 and up).
IntelliJ IDEAIntelliJ IDEAIntelliJ IDEAIntelliJ IDEA
סביבת הפיתוח הפופולרית ביותר ל-Java. בקורס משתמשים בגרסה החינמית, Community.
The most popular IDE for Java. The course uses the free edition, Community.
מופיע לראשונה: First appears: מפגשSession 1interfaceinterfaceinterfaceinterface
חוזה: רשימת מתודות שמחלקה מבטיחה לממש (implements). מחלקה יכולה לממש כמה interfaces. אין בו שדות של עצם.
A contract: a list of methods a class promises to implement (implements). A class can implement several interfaces. It has no object fields.
is-a מול has-ais-a vs has-ais-a vs has-ais-a מול has-a
ירושה מתאימה כשמשפט "X הוא סוג של Y" נכון תמיד (EBook הוא ספר). כש-X רק משתמש ב-Y, עדיף הרכבה (has-a): שדה מסוג Y.
Inheritance fits when "X is a kind of Y" is always true (an EBook is a book). When X only uses Y, prefer composition (has-a): a field of type Y.
מופיע לראשונה: First appears: מפגשSession 19IteratorIteratorIteratorIterator
עצם שעובר על אוסף: hasNext(), next(), ו-remove() שמוחק בבטחה את האיבר האחרון שהוחזר.
An object that walks a collection: hasNext(), next(), and remove() which safely deletes the last item returned.
jarjarjarjar
קובץ zip עם המחלקות המהודרות וקבצי המשאבים (תמונות, צלילים). jar --create --file game.jar --main-class Main -C out . ו-java -jar game.jar.
A zip file with the compiled classes and resource files (images, sounds). jar --create --file game.jar --main-class Main -C out . and java -jar game.jar.
JavaJavaJavaJava
שפת תכנות מבוססת מחלקות עם טיפוסים קבועים, שרצה על ה-JVM. משמשת לשרתים, אפליקציות Android, מערכות בנקאיות, ביג-דאטה ומשחקים.
A class-based, statically typed programming language that runs on the JVM. Used for servers, Android apps, banking systems, big data and games.
מופיע לראשונה: First appears: מפגשSession 1Java Memory ModelJava Memory ModelJava Memory ModelJava Memory Model
החלק במפרט של Java שמגדיר מה thread אחד רשאי לראות מהכתיבות של אחר. בלי happens-before, אין הבטחה.
The part of the Java spec defining what one thread may see of another's writes. Without happens-before, there's no promise.
מופיע לראשונה: First appears: מפגשSession 33JAVA_HOMEJAVA_HOMEJAVA_HOMEJAVA_HOME
משתנה סביבה שמצביע על התיקייה שבה מותקן ה-JDK. כלים כמו Maven ו-Gradle משתמשים בו כדי למצוא את Java.
An environment variable pointing at the folder where the JDK is installed. Tools like Maven and Gradle use it to find Java.
מופיע לראשונה: First appears: מפגשSession 1javacjavacjavacjavac
המהדר של Java. הפקודה javac Main.java בודקת את הקוד ויוצרת את הקובץ Main.class.
Java's compiler. The command javac Main.java checks the code and creates the file Main.class.
מופיע לראשונה: First appears: מפגשSession 1JDBCJDBCJDBCJDBC
הדרך הסטנדרטית של Java לדבר עם מסד נתונים: DriverManager.getConnection, PreparedStatement, ResultSet. כל מסד (PostgreSQL, MySQL, H2) מגיע עם driver משלו.
Java's standard way to talk to a database: DriverManager.getConnection, PreparedStatement, ResultSet. Each database (PostgreSQL, MySQL, H2) comes with its own driver.
JDKJDKJDKJDK
Java Development Kit: ערכת הפיתוח. כוללת את ה-JVM, את המהדר javac, את jshell ועוד כלים. מתקינים JDK כדי לכתוב Java.
Java Development Kit: the developer's kit. It includes the JVM, the javac compiler, jshell and more tools. You install a JDK to write Java.
מופיע לראשונה: First appears: מפגשSession 1JFrame ו-JPanelJFrame and JPanelJFrame and JPanelJFrame ו-JPanel
JFrame הוא החלון; JPanel הוא משטח בתוכו. דורסים ב-JPanel את paintComponent(Graphics g) כדי לצייר.
JFrame is the window; JPanel is a surface inside it. Override the JPanel's paintComponent(Graphics g) to draw.
joinjoinjoinjoin
t.join() עוצר את ה-thread הנוכחי עד ש-t מסיים. זה גם מבטיח שכל מה ש-t כתב נראה אחרי ה-join.
t.join() stops the current thread until t finishes. It also guarantees that whatever t wrote is visible after the join.
jpackagejpackagejpackagejpackage
כלי ב-JDK שאורז את ה-jar יחד עם Java עצמה לתוכנה רגילה (app ב-Mac, exe או msi ב-Windows). מי שמקבל לא צריך להתקין Java.
A JDK tool that packs the jar together with Java itself into a regular app (an app on Mac, an exe or msi on Windows). Whoever gets it doesn't need to install Java.
מופיע לראשונה: First appears: מפגשSession 48JREJREJREJRE
Java Runtime Environment: רק מה שצריך כדי להריץ תוכנות Java (JVM וספריות), בלי מהדר. היום מתקינים בדרך כלל JDK שלם.
Java Runtime Environment: just what's needed to run Java programs (the JVM and libraries), with no compiler. Today you usually install a whole JDK.
מופיע לראשונה: First appears: מפגשSession 1jshelljshelljshelljshell
כלי שמגיע עם ה-JDK ומאפשר להקליד שורת Java ולראות מיד את התוצאה, בלי class ובלי main.
A tool that comes with the JDK: type a line of Java and see the result at once, with no class and no main.
מופיע לראשונה: First appears: מפגשSession 1JSONJSONJSONJSON
פורמט טקסט לנתונים: {"title": "Dune", "year": 1965}, ומערכים ב-[...]. בפרויקט אמיתי משתמשים ב-Jackson או Gson, שממירים record ל-JSON ובחזרה בשורה אחת.
A text format for data: {"title": "Dune", "year": 1965}, with arrays in [...]. Real projects use Jackson or Gson, which turn a record into JSON and back in one line.
JUnit 5JUnit 5JUnit 5JUnit 5
ספריית הבדיקות הנפוצה ב-Java. כל מתודה עם @Test היא בדיקה, @BeforeEach רץ לפני כל אחת, ו-IntelliJ או mvn test מריצים הכול ומדווחים.
Java's common testing library. Each @Test method is a test, @BeforeEach runs before each one, and IntelliJ or mvn test runs them all and reports.
JVMJVMJVMJVM
Java Virtual Machine: "מחשב וירטואלי" שמריץ bytecode. יש JVM ל-Windows, ל-Mac, ל-Linux ואפילו לדפדפן, ולכן אותה תוכנה רצה בכולם.
Java Virtual Machine: a "virtual computer" that runs bytecode. There's a JVM for Windows, Mac, Linux and even the browser, so the same program runs on all of them.
מופיע לראשונה: First appears: מפגשSession 1KeyListenerKeyListenerKeyListenerKeyListener
מקבל אירועים: keyPressed כשלוחצים ו-keyReleased כשעוזבים. ה-JPanel צריך setFocusable(true) כדי לקבל אותם.
Receives events: keyPressed on press and keyReleased on release. The JPanel needs setFocusable(true) to get them.
lengthlengthlengthlength
מספר התאים במערך: a.length (בלי סוגריים, בשונה מ-length() של String). האינדקס האחרון הוא a.length - 1.
The number of cells in an array: a.length (no brackets, unlike String's length()). The last index is a.length - 1.
LinkedHashSetLinkedHashSetLinkedHashSetLinkedHashSet
Set ששומר את סדר ההכנסה. מהיר כמו HashSet.
A Set that keeps insertion order. As fast as a HashSet.
מופיע לראשונה: First appears: מפגשSession 25livelocklivelocklivelocklivelock
threads לא תקועים, אבל כל הזמן מוותרים זה לזה ומנסים שוב, ולכן לא מתקדמים. פתרון: המתנה אקראית לפני ניסיון חוזר.
Threads aren't stuck, but keep giving way to each other and retrying, so they never progress. Fix: a random wait before retrying.
מופיע לראשונה: First appears: מפגשSession 38LTSLTSLTSLTS
Long-Term Support: גרסה שמקבלת עדכונים ותיקונים במשך שנים. Java 21 היא גרסת LTS, ולכן הקורס בנוי עליה.
Long-Term Support: a version that gets updates and fixes for years. Java 21 is an LTS version, so the course is built on it.
מופיע לראשונה: First appears: מפגשSession 1manifestmanifestmanifestmanifest
קובץ META-INF/MANIFEST.MF בתוך ה-jar. השורה Main-Class: Main אומרת ל-java -jar מאיפה להתחיל.
The META-INF/MANIFEST.MF file inside the jar. The line Main-Class: Main tells java -jar where to start.
MavenMavenMavenMaven
כלי בנייה: קובץ pom.xml מגדיר את הפרויקט ואת התלויות (למשל JUnit), והוא מוריד אותן לבד. קוד ב-src/main/java, בדיקות ב-src/test/java. mvn test, mvn package.
A build tool: pom.xml defines the project and its dependencies (e.g. JUnit), which it downloads itself. Code in src/main/java, tests in src/test/java. mvn test, mvn package.
method referencemethod referencemethod referencemethod reference
קיצור ללמבדה שרק קוראת למתודה: String::length במקום s -> s.length(), System.out::println, Book::new.
A shorthand for a lambda that only calls a method: String::length instead of s -> s.length(), System.out::println, Book::new.
multi-catchmulti-catchmulti-catchmulti-catch
catch (ArithmeticException | NumberFormatException e): טיפול אחד לכמה סוגי חריגות.
catch (ArithmeticException | NumberFormatException e): one handler for several exception types.
newnewnewnew
יוצר עצם חדש ב-heap ומחזיר הפניה אליו: Book b = new Book();.
Creates a new object on the heap and returns a reference to it: Book b = new Book();.
NoSuchFileExceptionNoSuchFileExceptionNoSuchFileExceptionNoSuchFileException
החריגה כשקוראים קובץ שלא קיים. היא IOException, כלומר checked.
The exception when reading a file that doesn't exist. It's an IOException, so it's checked.
nullnullnullnull
הפניה שלא מצביעה על שום עצם. משתנה מסוג עצם שלא קיבל ערך, או תא חדש במערך של עצמים, הוא null.
A reference that points to no object. An object variable that got no value, or a new cell in an array of objects, is null.
NullPointerExceptionNullPointerExceptionNullPointerExceptionNullPointerException
החריגה כשמנסים לגשת לשדה או למתודה דרך null. Java 21 אומרת בדיוק מה היה null: Cannot read field "title" because "b" is null.
The exception when you reach a field or method through null. Java 21 says exactly what was null: Cannot read field "title" because "b" is null.
NumberFormatExceptionNumberFormatExceptionNumberFormatExceptionNumberFormatException
נזרקת כש-Integer.parseInt או Double.parseDouble מקבלות טקסט שאינו מספר: For input string: "12a".
Thrown when Integer.parseInt or Double.parseDouble get text that isn't a number: For input string: "12a".
ObserverObserverObserverObserver
עצם שומר רשימת "מאזינים" ומודיע לכולם כשמשהו קורה. המאזינים לא תלויים זה בזה.
An object keeps a list of "listeners" and notifies them all when something happens. The listeners don't depend on each other.
מופיע לראשונה: First appears: מפגשSession 24OptionalOptionalOptionalOptional
קופסה שאולי יש בה ערך. findFirst מחזיר Optional, ומטפלים במקרה הריק במפורש: orElse, map, ifPresentOrElse. בלי NullPointerException.
A box that may hold a value. findFirst returns an Optional, and you handle the empty case explicitly: orElse, map, ifPresentOrElse. No NullPointerException.
PATHPATHPATHPATH
רשימת התיקיות שבהן הטרמינל מחפש תוכנות. אם התיקייה bin של ה-JDK לא ב-PATH, הפקודה javac "לא מוכרת".
The list of folders where the terminal looks for programs. If the JDK's bin folder isn't on PATH, the javac command is "not recognized".
מופיע לראשונה: First appears: מפגשSession 1PathPathPathPath
כתובת של קובץ או תיקייה: Path.of("library", "scifi"). נתיב יחסי מתחיל מהתיקייה שבה התוכנית רצה.
The address of a file or folder: Path.of("library", "scifi"). A relative path starts from the folder the program runs in.
PECSPECSPECSPECS
Producer Extends, Consumer Super: רשימה שרק קוראים ממנה היא ? extends T, ורשימה שרק כותבים אליה היא ? super T.
Producer Extends, Consumer Super: a list you only read from is ? extends T, and a list you only write to is ? super T.
Predicate, Function, Consumer, SupplierPredicate, Function, Consumer, SupplierPredicate, Function, Consumer, SupplierPredicate, Function, Consumer, Supplier
Predicate<T>: T → boolean (test). Function<T, R>: T → R (apply). Consumer<T>: T → כלום (accept). Supplier<T>: כלום → T (get).
Predicate<T>: T → boolean (test). Function<T, R>: T → R (apply). Consumer<T>: T → nothing (accept). Supplier<T>: nothing → T (get).
printlnprintlnprintlnprintln
System.out.println מציגה ערך על המסך ויורדת שורה. System.out.print מציגה בלי לרדת שורה.
System.out.println shows a value on the screen and moves to a new line. System.out.print shows it without a new line.
מופיע לראשונה: First appears: מפגשSession 1PriorityQueuePriorityQueuePriorityQueuePriorityQueue
תור ש-poll שלו מחזיר תמיד את האיבר הקטן ביותר (לפי הסדר הטבעי או Comparator), לא את הראשון שנכנס.
A queue whose poll always returns the smallest item (by natural order or a Comparator), not the first one in.
privateprivateprivateprivate
שדה או מתודה שנגישים רק מתוך המחלקה עצמה. מבחוץ javac עוצר: rating has private access in Book.
A field or method reachable only inside its own class. From outside javac stops: rating has private access in Book.
promptpromptpromptprompt
הטקסט ששולחים למודל: מה התפקיד, אילו נתונים יש, ובאיזו צורה לענות. prompt מדויק נותן תשובה שקל לבדוק.
The text sent to the model: the role, the data available, and the shape of the answer. A precise prompt gives an answer that's easy to check.
מופיע לראשונה: First appears: מפגשSession 41protectedprotectedprotectedprotected
גישה למחלקה, לתת-המחלקות שלה ולמחלקות באותה חבילה. נוח, אבל חושף מימוש לכל מי שיורש.
Access for the class, its subclasses and classes in the same package. Handy, but it exposes the implementation to every subclass.
מופיע לראשונה: First appears: מפגשSession 19ReadWriteLockReadWriteLockReadWriteLockReadWriteLock
שני מנעולים: כמה קוראים יחד, או כותב אחד לבד. טוב כשיש הרבה קריאות ומעט כתיבות.
Two locks: several readers together, or one writer alone. Good when there are many reads and few writes.
מופיע לראשונה: First appears: מפגשSession 36recordrecordrecordrecord
record Book(String title, int year) {}: מחלקה בלתי משתנה לנתונים. Java כותבת לבד בנאי, title(), year(), equals, hashCode ו-toString (Book[title=Dune, year=1965]).
record Book(String title, int year) {}: an immutable data class. Java writes the constructor, title(), year(), equals, hashCode and toString (Book[title=Dune, year=1965]) for you.
reentrantreentrantreentrantreentrant
thread שכבר מחזיק מנעול יכול להיכנס אליו שוב (למשל מתודה synchronized שקוראת למתודה synchronized אחרת של אותו עצם) בלי לחסום את עצמו.
A thread already holding a lock can enter it again (e.g. a synchronized method calling another synchronized method of the same object) without blocking itself.
מופיע לראשונה: First appears: מפגשSession 32ReentrantLockReentrantLockReentrantLockReentrantLock
מנעול מפורש: lock(), ואז try { ... } finally { unlock(); }. מאפשר tryLock (גם עם זמן קצוב) ו-lockInterruptibly.
An explicit lock: lock(), then try { ... } finally { unlock(); }. It allows tryLock (with a timeout too) and lockInterruptibly.
RepositoryRepositoryRepositoryRepository
interface שמסתיר איפה הנתונים נשמרים (save, findByAuthor). מימוש אחד מדבר עם מסד נתונים, ואחר שומר בזיכרון לבדיקות.
An interface hiding where data is kept (save, findByAuthor). One implementation talks to a database, another keeps it in memory for tests.
RESTRESTRESTREST
סגנון API מעל HTTP: כל דבר הוא משאב בכתובת (/books/Dune), והשיטה אומרת מה עושים: GET קורא, POST יוצר, PUT מעדכן, DELETE מוחק.
An API style over HTTP: everything is a resource at an address (/books/Dune), and the method says what to do: GET reads, POST creates, PUT updates, DELETE deletes.
RunnableRunnableRunnableRunnable
functional interface עם void run(): העבודה שה-thread יעשה. new Thread(() -> ...) מקבל אותה כלמבדה.
A functional interface with void run(): the work the thread will do. new Thread(() -> ...) takes it as a lambda.
ScannerScannerScannerScanner
מחלקה שקוראת קלט: Scanner sc = new Scanner(System.in);, ואז sc.nextLine(), sc.nextInt() וכו'.
A class that reads input: Scanner sc = new Scanner(System.in);, then sc.nextLine(), sc.nextInt() and so on.
sealedsealedsealedsealed
sealed interface Shape permits Circle, Rect: רק הטיפוסים שברשימה רשאים לממש. כך javac יודע את כל האפשרויות.
sealed interface Shape permits Circle, Rect: only the listed types may implement it. That way javac knows every possibility.
seedseedseedseed
new Random(42) מייצר תמיד את אותה סדרה "אקראית". במשחק אמיתי בלי seed; בבדיקות עם seed, כדי שהתוצאה תהיה קבועה.
new Random(42) always produces the same "random" sequence. In the real game no seed; in tests with a seed, so the result is fixed.
shutdownshutdownshutdownshutdown
shutdown() מפסיק לקבל משימות חדשות ונותן לקיימות לסיים. awaitTermination מחכה לזה. בלי shutdown התוכנית עלולה לא להסתיים.
shutdown() stops taking new tasks and lets the current ones finish. awaitTermination waits for that. Without shutdown the program may never end.
SingletonSingletonSingletonSingleton
מחלקה עם מופע יחיד לכל התוכנית (הכי פשוט: enum עם ערך אחד). הבעיה: זה מצב גלובלי, וקשה לבדוק ולהחליף אותו.
A class with a single instance for the whole program (simplest: an enum with one value). The problem: it's global state, hard to test and to swap.
SOLIDSOLIDSOLIDSOLID
חמישה עקרונות: S – אחריות אחת למחלקה; O – פתוח להרחבה, סגור לשינוי; L – תת-מחלקה עובדת בכל מקום שההורה עובד; I – interfaces קטנים וממוקדים; D – תלות ב-interfaces, לא במימושים.
Five principles: S – one job per class; O – open to extension, closed to change; L – a subclass works wherever the parent works; I – small, focused interfaces; D – depend on interfaces, not implementations.
מופיע לראשונה: First appears: מפגשSession 24Spring BootSpring BootSpring BootSpring Boot
framework שמרים שרת אינטרנט ב-Java בכמה שורות. מחלקה עם @RestController ומתודות עם @GetMapping("/books") הופכות לנקודות קצה.
A framework that starts a Java web server in a few lines. A class with @RestController and methods with @GetMapping("/books") become endpoints.
spritespritespritesprite
תמונה קטנה של דמות או עצם במשחק. נטענת עם ImageIO.read ומצוירת עם g.drawImage. sprite sheet: הרבה פריימים בתמונה אחת, ברשת.
A small picture of a character or object in a game. Loaded with ImageIO.read and drawn with g.drawImage. A sprite sheet: many frames in one picture, on a grid.
SQL injectionSQL injectionSQL injectionSQL injection
כשמחברים קלט של משתמש לתוך מחרוזת SQL, הקלט יכול לשנות את השאילתה (' OR '1'='1). פרמטרים (?) שולחים את הקלט בנפרד, כנתון ולא כקוד.
When user input is glued into an SQL string, the input can change the query (' OR '1'='1). Parameters (?) send the input separately, as data and not as code.
stack tracestack tracestack tracestack trace
הרשימה שמופיעה מתחת לחריגה, שורות שמתחילות ב-at. היא אומרת באיזו מתודה ובאיזו שורה החריגה קרתה.
The list under an exception, lines starting with at. It says which method and which line the exception happened on.
מופיע לראשונה: First appears: מפגשSession 1start מול runstart vs runstart vs runstart מול run
start() יוצר thread חדש שמריץ את run(). קריאה ישירה ל-run() היא סתם קריאה למתודה, באותו thread.
start() creates a new thread that runs run(). Calling run() directly is just a method call, on the same thread.
Step IntoStep IntoStep IntoStep Into
נכנס לתוך המתודה שנקראת בשורה הנוכחית, כדי לראות מה קורה בתוכה. קיצור: F7.
Goes into the method called on the current line, to see what happens inside it. Shortcut: F7.
מופיע לראשונה: First appears: מפגשSession 11Step OverStep OverStep OverStep Over
מריץ את השורה הנוכחית כולה (גם אם יש בה קריאה למתודה) ועוצר בשורה הבאה. קיצור: F8.
Runs the current line completely (even if it calls a method) and stops at the next line. Shortcut: F8.
מופיע לראשונה: First appears: מפגשSession 11StrategyStrategyStrategyStrategy
משפחת אלגוריתמים מאחורי interface אחד (Comparator, Discount). מי שמשתמש מקבל אסטרטגיה ולא יודע איזו.
A family of algorithms behind one interface (Comparator, Discount). The user gets a strategy and doesn't know which one.
StreamStreamStreamStream
"פס ייצור" על אוסף: books.stream().filter(...).map(...).toList(). לא משנה את האוסף המקורי.
A "production line" over a collection: books.stream().filter(...).map(...).toList(). It doesn't change the original collection.
StringBuilderStringBuilderStringBuilderStringBuilder
"מחרוזת שמשתנה": מוסיפים לה עם append בלי ליצור עצם חדש כל פעם, ובסוף toString().
A "string you can change": add to it with append without making a new object each time, then toString() at the end.
supersupersupersuper
super(...) בשורה הראשונה של בנאי קורא לבנאי של ההורה. super.describe() קורא לגרסה של ההורה מתוך מתודה שדורסת אותה.
super(...) on a constructor's first line calls the parent's constructor. super.describe() calls the parent's version from inside a method that overrides it.
switch עם חציםswitch expressionswitch expressionswitch עם חצים
switch שבו כל case כתוב עם ->: רק הענף המתאים רץ, ואפשר להחזיר ממנו ערך: String s = switch (day) { case 1 -> "Sun"; ... };.
A switch where every case uses ->: only the matching branch runs, and it can return a value: String s = switch (day) { case 1 -> "Sun"; ... };.
switch עם תבניותpattern switchpattern switchswitch עם תבניות
switch (s) { case Circle c -> ...; } בודק את הסוג ונותן משתנה מוכן. case ... when תנאי מוסיף תנאי.
switch (s) { case Circle c -> ...; } checks the type and gives a ready variable. case ... when condition adds a condition.
synchronizedsynchronizedsynchronizedsynchronized
synchronized void inc() או synchronized (lock) { ... }: רק thread אחד בכל פעם נכנס, והשאר מחכים (BLOCKED). גם מבטיח שהכתיבות נראות ל-thread הבא שנכנס.
synchronized void inc() or synchronized (lock) { ... }: only one thread at a time gets in, the rest wait (BLOCKED). It also makes the writes visible to the next thread that enters.
Template MethodTemplate MethodTemplate MethodTemplate Method
מתודה בהורה (לרוב final) שקובעת את סדר השלבים, ומשאירה שלבים מופשטים לתת-המחלקות.
A method in the parent (often final) that fixes the order of the steps, leaving abstract steps to the subclasses.
thisthisthisthis
הפניה לעצם הנוכחי. this.title הוא השדה, ו-title לבד הוא הפרמטר אם יש פרמטר בשם הזה.
A reference to the current object. this.title is the field, and plain title is the parameter if there's a parameter with that name.
threadthreadthreadthread
"קו ביצוע" בתוך תוכנית. לכל thread יש stack משלו, אבל כולם חולקים את ה-heap. main הוא thread בעצמו.
A "line of execution" inside a program. Each thread has its own stack, but they all share the heap. main is a thread itself.
thread dumpthread dumpthread dumpthread dump
תמונה של כל ה-threads ומה כל אחד מחזיק ומחכה לו. jstack <pid> (או Ctrl+Break) מדפיס אותה, וכותב Found one Java-level deadlock כשיש.
A snapshot of every thread and what it holds and waits for. jstack <pid> (or Ctrl+Break) prints it, and says Found one Java-level deadlock when there is one.
throwthrowthrowthrow
זורק חריגה בעצמכם: throw new IllegalArgumentException("...");. המתודה נעצרת מיד, והחריגה עולה למי שקרא לה.
Throws an exception yourself: throw new IllegalArgumentException("...");. The method stops at once, and the exception goes up to its caller.
throwsthrowsthrowsthrows
static String load(...) throws IOException: "המתודה הזו עלולה לזרוק IOException, ומי שקורא לה צריך לטפל".
static String load(...) throws IOException: "this method may throw an IOException, and its caller must deal with it".
toStringtoStringtoStringtoString
המחרוזת שמייצגת עצם. println(b), "x" + b ו-List.toString קוראים לה. בלי לדרוס יוצא משהו כמו Book@1b6d3586.
The string that stands for an object. println(b), "x" + b and List.toString call it. Without an override you get something like Book@1b6d3586.
TreeMapTreeMapTreeMapTreeMap
Map עם מפתחות ממוינים: firstKey, lastEntry, headMap(k) (כל מה שקטן מ-k).
A Map with sorted keys: firstKey, lastEntry, headMap(k) (everything smaller than k).
TreeSetTreeSetTreeSetTreeSet
Set ממוין תמיד (לפי Comparable או Comparator), עם ניווט: floor, ceiling, subSet.
An always-sorted Set (by Comparable or a Comparator), with navigation: floor, ceiling, subSet.
try ו-catchtry and catchtry and catchtry ו-catch
try { ... } catch (SomeException e) { ... }: אם בתוך ה-try נזרקת חריגה מהסוג הזה, קופצים ל-catch במקום לקרוס. השורות שאחרי מקום החריגה ב-try לא רצות.
try { ... } catch (SomeException e) { ... }: if an exception of that type is thrown inside the try, jump to the catch instead of crashing. The lines after the throw point in the try don't run.
try-with-resourcestry-with-resourcestry-with-resourcestry-with-resources
try (Res r = new Res()) { ... }: בסוף הבלוק Java קוראת ל-close() לבד, גם אם נזרקה חריגה. כמה משאבים נסגרים בסדר הפוך.
try (Res r = new Res()) { ... }: at the end of the block Java calls close() itself, even if an exception was thrown. Several resources close in reverse order.
varvarvarvar
במקום לכתוב טיפוס, var אומר למהדר להסיק אותו מהערך: var n = 5; הוא int. הטיפוס עדיין קבוע.
Instead of writing a type, var tells the compiler to infer it from the value: var n = 5; is an int. The type is still fixed.
virtual threadvirtual threadvirtual threadvirtual thread
thread קל מאוד (Java 21) שה-JVM מנהל. כשהוא מחכה (sleep, רשת, קובץ) הוא לא תופס thread של מערכת ההפעלה, ולכן אפשר להריץ עשרות אלפים.
A very light thread (Java 21) managed by the JVM. When it waits (sleep, network, a file) it doesn't hold an OS thread, so you can run tens of thousands.
מופיע לראשונה: First appears: מפגשSession 37voidvoidvoidvoid
מתודה void לא מחזירה ערך: היא עושה משהו (למשל מדפיסה) וחוזרת.
A void method returns no value: it does something (like printing) and goes back.
volatilevolatilevolatilevolatile
volatile boolean running: כל קריאה רואה את הכתיבה האחרונה, וכל מה שנכתב לפני כתיבה ל-volatile נראה למי שקורא אותו. לא נותן אטומיות: count++ עדיין לא בטוח.
volatile boolean running: every read sees the latest write, and whatever was written before a volatile write is visible to whoever reads it. It gives no atomicity: count++ still isn't safe.
wait ו-notifywait and notifywait and notifywait ו-notify
lock.wait() משחרר את המנעול ונרדם עד ש-lock.notifyAll() מעיר אותו (ואז הוא מחכה לקבל את המנעול שוב). שניהם רק בתוך synchronized (lock).
lock.wait() releases the lock and sleeps until lock.notifyAll() wakes it (then it waits to get the lock back). Both only inside synchronized (lock).
wildcardwildcardwildcardwildcard
? בטיפוס של פרמטר: List<? extends Number> מקבלת List<Integer> וגם List<Double>.
? in a parameter's type: List<? extends Number> accepts a List<Integer> and a List<Double>.
אופרטורoperatoroperatorאופרטור
סימן שעושה פעולה על ערכים: + - * / %. בין מחרוזות, + מחבר אותן.
A symbol that does something to values: + - * / %. Between strings, + joins them.
מופיע לראשונה: First appears: מפגשSession 1אופרטור טרנריternary operatorternary operatorאופרטור טרנרי
תנאי ? ערך1 : ערך2: if קצר שמחזיר ערך. String s = n > 0 ? "plus" : "not plus";.
condition ? value1 : value2: a short if that returns a value. String s = n > 0 ? "plus" : "not plus";.
אופרטור לוגיlogical operatorlogical operatorאופרטור לוגי
מחבר תנאים: && (וגם: שניהם נכונים), || (או: לפחות אחד), ! (לא: הופך).
Joins conditions: && (and: both true), || (or: at least one), ! (not: flips).
אחריות אחתsingle responsibilitysingle responsibilityאחריות אחת
לכל מחלקה תפקיד אחד ברור: Author יודעת על סופר, Book על ספר, ו-Shelf מנהלת אוסף. כשמשהו משתנה, ברור איפה לתקן.
Each class has one clear job: Author knows about an author, Book about a book, and Shelf manages a collection. When something changes, it's clear where to fix it.
אינדקסindexindexאינדקס
המספר של מקום במחרוזת (או במערך). מתחילים מ-0: ב-"java" התו באינדקס 0 הוא j.
The number of a position in a string (or an array). It starts at 0: in "java" the character at index 0 is j.
אינווריאנטinvariantinvariantאינווריאנט
כלל שתמיד נכון על העצם, למשל "הדירוג בין 1 ל-5". הבנאי וה-setters זורקים חריגה במקום לשבור אותו.
A rule that's always true about the object, e.g. "the rating is between 1 and 5". The constructor and setters throw instead of breaking it.
מופיע לראשונה: First appears: מפגשSession 15אנימציה מפריימיםframe animationframe animationאנימציה מפריימים
מחליפים פריים כל כמה מאיות שנייה: frame = (int) (time / frameSeconds) % frames.
Switch the frame every few hundredths of a second: frame = (int) (time / frameSeconds) % frames.
אסינכרוניasynchronousasynchronousאסינכרוני
"תתחיל את זה, ותודיע לי כשיש תוצאה", במקום לחכות בשורה. שימושי כשרוב הזמן מחכים לרשת או לדיסק.
"Start this, and tell me when there's a result", instead of waiting in line. Useful when most of the time is spent waiting for the network or disk.
מופיע לראשונה: First appears: מפגשSession 37ארגומנטargumentargumentארגומנט
הערך שנותנים לפרמטר בקריאה: ב-add(2, 3) הארגומנטים הם 2 ו-3.
The value given to a parameter in a call: in add(2, 3) the arguments are 2 and 3.
באגbugbugבאג
טעות בתוכנית שגורמת לה להתנהג אחרת ממה שרצינו. לחפש ולתקן באגים נקרא דיבוג (debugging).
A mistake in a program that makes it behave differently from what we wanted. Finding and fixing bugs is called debugging.
מופיע לראשונה: First appears: מפגשSession 1בדיקה ואז פעולהcheck-then-actcheck-then-actבדיקה ואז פעולה
if (copies > 0) copies--;: בין הבדיקה לפעולה thread אחר יכול להיכנס. הבדיקה והפעולה חייבות להיות באותו קטע מוגן.
if (copies > 0) copies--;: between the check and the act another thread can slip in. The check and the act must be in the same protected section.
בדיקה ידניתmanual testmanual testבדיקה ידנית
קוד קטן שמריץ את המחלקות ובודק תוצאות צפויות, ומדפיס PASS או FAIL. במפגש 29 נעבור ל-JUnit, שעושה את זה בצורה מסודרת.
Small code that runs the classes and checks expected results, printing PASS or FAIL. In session 29 we move to JUnit, which does this properly.
מופיע לראשונה: First appears: מפגשSession 18בדיקת הפלטvalidating outputvalidating outputבדיקת הפלט
לפני שמשתמשים בתשובה: בודקים שהיא בפורמט הנכון ושהיא הגיונית (למשל שהספר באמת במדף). אם לא, ברירת מחדל.
Before using a reply: check it's in the right format and makes sense (say, the book really is on the shelf). If not, a fallback.
מופיע לראשונה: First appears: מפגשSession 41בדיקת יחידהunit testunit testבדיקת יחידה
קוד קטן שבודק יחידה אחת (מתודה, מחלקה) במצב אחד: מכינים (Arrange), מפעילים (Act), ובודקים את התוצאה (Assert). רץ בשנייה, ואפשר להריץ אחרי כל שינוי.
Small code checking one unit (a method, a class) in one situation: set up (Arrange), run (Act), check the result (Assert). It runs in a second, after every change.
מופיע לראשונה: First appears: מפגשSession 30בדיקת קלטinput validationinput validationבדיקת קלט
בודקים שהקלט הגיוני לפני שמשתמשים בו: hasNextInt() לפני nextInt(), ובדיקת טווח.
Checking input makes sense before using it: hasNextInt() before nextInt(), and a range check.
ביטוי בוליאניboolean expressionboolean expressionביטוי בוליאני
ביטוי שהערך שלו הוא true או false: השוואה, שילוב של השוואות, או משתנה boolean.
An expression whose value is true or false: a comparison, a mix of comparisons, or a boolean variable.
בלוקblockblockבלוק
קבוצת שורות בין סוגר מסולסל פותח { לסוגר סוגר }. הבלוק שייך למה שכתוב לפניו: מחלקה, מתודה, תנאי או לולאה.
A group of lines between an opening { and a closing }. The block belongs to what comes right before it: a class, a method, a condition or a loop.
מופיע לראשונה: First appears: מפגשSession 1בנאיconstructorconstructorבנאי
"מתודה" מיוחדת בשם המחלקה, בלי טיפוס החזרה, שרצה ב-new: Book(String title) { this.title = title; }.
A special "method" named after the class, with no return type, that runs on new: Book(String title) { this.title = title; }.
בנאי ברירת מחדלdefault constructordefault constructorבנאי ברירת מחדל
אם לא כתבתם שום בנאי, Java נותנת בנאי ריק בלי פרמטרים. ברגע שכתבתם בנאי כלשהו, הוא נעלם.
If you wrote no constructor, Java gives an empty one with no parameters. As soon as you write any constructor, it's gone.
מופיע לראשונה: First appears: מפגשSession 14בנאי מקוצרcompact constructorcompact constructorבנאי מקוצר
Book { if (year < 0) throw ...; } בתוך record: בנאי בלי רשימת פרמטרים, שרץ לפני שהשדות נקבעים. המקום לבדיקות.
Book { if (year < 0) throw ...; } inside a record: a constructor with no parameter list, running before the fields are set. The place for checks.
בריכת threadsthread poolthread poolבריכת threads
מספר קבוע של threads שלוקחים משימות מתור. יצירת thread יקרה, ולכן משתמשים שוב באותם threads.
A fixed number of threads taking tasks from a queue. Creating a thread is expensive, so the same threads are reused.
מופיע לראשונה: First appears: מפגשSession 35גלולת רעלpoison pillpoison pillגלולת רעל
ערך מיוחד שהיצרן שם בתור כדי לומר לצרכן "זהו, אפשר לסיים". אחד לכל צרכן.
A special value the producer puts in the queue to tell a consumer "that's it, you can stop". One per consumer.
מופיע לראשונה: First appears: מפגשSession 34גלישה (overflow)overflowoverflowגלישה (overflow)
כשהתוצאה גדולה מדי לטיפוס, היא "מתגלגלת" למספר שגוי, בלי שגיאה. int מגיע עד כ-2.1 מיליארד.
When a result is too big for the type it "wraps around" to a wrong number, with no error. int goes up to about 2.1 billion.
דיבאגרdebuggerdebuggerדיבאגר
כלי שמריץ את התוכנית לאט, עוצר איפה שביקשתם ומראה את ערכי המשתנים. ב-IntelliJ: הכפתור עם החיפושית (Debug) במקום ▶.
A tool that runs the program slowly, stops where you asked and shows the variables' values. In IntelliJ: the bug button (Debug) instead of ▶.
מופיע לראשונה: First appears: מפגשSession 11דריסהoverridingoverridingדריסה
מתודה בתת-מחלקה עם אותה חתימה בדיוק כמו בהורה, שמחליפה את ההתנהגות. @Override מבקש מ-javac לוודא שזו באמת דריסה.
A method in a subclass with exactly the parent's signature, replacing the behaviour. @Override asks javac to make sure it really is an override.
האצלהdelegationdelegationהאצלה
מתודה שמעבירה את העבודה לעצם אחר: Shelf.size() מחזירה books.size().
A method handing the work to another object: Shelf.size() returns books.size().
הזרקת תלויותdependency injectiondependency injectionהזרקת תלויות
מחלקה מקבלת את מה שהיא צריכה בבנאי, במקום ליצור אותו. ב-Spring זה קורה לבד; כאן כותבים new BookController(new BookService(repo)).
A class receives what it needs in its constructor, instead of creating it. In Spring that happens for you; here we write new BookController(new BookService(repo)).
החוזה של equals ו-hashCodethe equals/hashCode contractthe equals/hashCode contractהחוזה של equals ו-hashCode
אם a.equals(b), אז a.hashCode() == b.hashCode(). דורסים את שתיהן יחד, על סמך אותם שדות. equals גם צריכה להיות סימטרית: a.equals(b) אם ורק אם b.equals(a).
If a.equals(b), then a.hashCode() == b.hashCode(). Override both together, based on the same fields. equals must also be symmetric: a.equals(b) exactly when b.equals(a).
היפוך תלותdependency inversiondependency inversionהיפוך תלות
מחלקה מקבלת את מה שהיא צריכה מבחוץ, כ-interface (Reminder(Sender sender)), במקום ליצור אותו בעצמה. כך בבדיקה מעבירים מימוש מזויף.
A class receives what it needs from outside, as an interface (Reminder(Sender sender)), instead of creating it itself. In a test you then pass a fake.
המרה למטהdowncastdowncastהמרה למטה
(EBook) item: אומרים ל-javac "תאמין לי, זה EBook". אם זה לא נכון, בזמן ריצה נזרקת ClassCastException.
(EBook) item: telling javac "trust me, it's an EBook". If that's wrong, a ClassCastException is thrown at run time.
המרה מפורשת (cast)castcastהמרה מפורשת (cast)
כותבים טיפוס בסוגריים כדי להמיר: (int) 3.9 נותן 3. בהמרה מ-double ל-int החלק העשרוני נחתך.
Writing a type in brackets to convert: (int) 3.9 gives 3. Going from double to int cuts off the decimal part.
המתודה mainthe main methodthe main methodהמתודה main
public static void main(String[] args): נקודת הכניסה של התוכנית. ה-JVM מתחילה לבצע מכאן.
public static void main(String[] args): the program's entry point. The JVM starts running from here.
מופיע לראשונה: First appears: מפגשSession 1הסתרהshadowingshadowingהסתרה
כשלפרמטר או למשתנה מקומי יש שם של שדה, הוא "מסתיר" את השדה. title = title; משים את הפרמטר לעצמו, והשדה נשאר null.
When a parameter or local variable has a field's name, it "hides" the field. title = title; assigns the parameter to itself, and the field stays null.
העברה לפי ערךpass-by-valuepass-by-valueהעברה לפי ערך
ב-Java כל ארגומנט מועתק לפרמטר. למספר: המתודה לא יכולה לשנות את המשתנה של הקורא. להפניה: מועתקת ההפניה, ושתיהן מצביעות על אותו עצם.
In Java every argument is copied into the parameter. For a number: the method can't change the caller's variable. For a reference: the reference is copied, and both point to the same object.
מופיע לראשונה: First appears: מפגשSession 7העמסה (overloading)overloadingoverloadingהעמסה (overloading)
כמה מתודות עם אותו שם ופרמטרים שונים. Java בוחרת לפי הארגומנטים: max(int, int) מול max(double, double).
Several methods with the same name and different parameters. Java picks by the arguments: max(int, int) vs max(double, double).
הערהcommentcommentהערה
טקסט בקוד שהמהדר מדלג עליו, בשביל בני אדם: // עד סוף השורה, או בין /* ל-*/.
Text in the code that the compiler skips, for people: // to the end of the line, or between /* and */.
מופיע לראשונה: First appears: מפגשSession 1העתקה מגינהdefensive copydefensive copyהעתקה מגינה
מחזירים עותק (או תצוגה לקריאה בלבד) של אוסף פנימי, כדי שאיש לא ישנה אותו מבחוץ: return List.copyOf(songs);.
Return a copy (or a read-only view) of an inner collection, so nobody changes it from outside: return List.copyOf(songs);.
הפניהreferencereferenceהפניה
מה שיושב בקופסה של משתנה מסוג עצם: לא העצם עצמו, אלא "כתובת" שמצביעה עליו ב-heap.
What sits in the box of an object-type variable: not the object itself, but an "address" pointing to it on the heap.
מופיע לראשונה: First appears: מפגשSession 3הפניה finalfinal referencefinal referenceהפניה final
final int[] a אומר שאי אפשר להצביע עם a על מערך אחר. את התוכן של המערך עדיין אפשר לשנות.
final int[] a means a can't be pointed at another array. The array's contents can still change.
הצהרהdeclarationdeclarationהצהרה
השורה שיוצרת משתנה: טיפוס ושם, למשל int score;.
The line that creates a variable: a type and a name, like int score;.
הקשר סטטיstatic contextstatic contextהקשר סטטי
קוד בתוך מתודה static (כמו main). אין שם this, ולכן אי אפשר לפנות ישירות לשדה או למתודה של עצם: non-static method greet() cannot be referenced from a static context.
Code inside a static method (like main). There's no this there, so you can't reach an object's field or method directly: non-static method greet() cannot be referenced from a static context.
הרכבה (has-a)composition (has-a)composition (has-a)הרכבה (has-a)
עצם שמחזיק עצמים אחרים בשדות: Book מחזיק Author. כמה ספרים יכולים להצביע על אותו סופר.
An object holding other objects in its fields: Book holds an Author. Several books can point to the same author.
הרעבהstarvationstarvationהרעבה
thread שכמעט אף פעם לא מקבל את המנעול כי אחרים תמיד מקדימים. מנעול הוגן (new ReentrantLock(true)) משרת לפי סדר הגעה.
A thread that almost never gets the lock because others always get there first. A fair lock (new ReentrantLock(true)) serves in order of arrival.
השמהassignmentassignmentהשמה
שמים ערך בקופסה עם =. הערך הקודם נמחק. = הוא "שים", לא "שווה".
Putting a value in a box with =. The old value is gone. = means "put", not "equals".
התעוררות שקריתspurious wakeupspurious wakeupהתעוררות שקרית
thread יכול להתעורר מ-wait בלי סיבה, או אחרי שמישהו אחר כבר לקח את מה שחיכה לו. לכן בודקים את התנאי ב-while, לא ב-if.
A thread can wake from wait for no reason, or after someone else already took what it waited for. That's why the condition is checked in a while, not an if.
התקנהinstallationinstallationהתקנה
הכנסת תוכנה למחשב כך שאפשר להשתמש בה. בקורס מתקינים JDK ו-IntelliJ IDEA פעם אחת.
Putting a program onto the computer so you can use it. In this course you install a JDK and IntelliJ IDEA once.
מופיע לראשונה: First appears: מפגשSession 1חבר staticstatic memberstatic memberחבר static
שדה או מתודה ששייכים למחלקה עצמה, בעותק אחד: Ticket.count, Math.max. לא צריך עצם כדי להשתמש בהם.
A field or method that belongs to the class itself, in one copy: Ticket.count, Math.max. No object is needed to use them.
חבר מופעinstance memberinstance memberחבר מופע
שדה או מתודה בלי static: לכל עצם יש עותק משלו של השדה (a.n ו-b.n נפרדים), וקוראים למתודה דרך עצם.
A field or method without static: every object has its own copy of the field (a.n and b.n are separate), and you call the method through an object.
חיפוש בינאריbinary searchbinary searchחיפוש בינארי
חיפוש במערך ממוין: בודקים את האמצע וזורקים חצי בכל צעד. O(log n): מיליון איברים בכ-20 צעדים.
Searching a sorted array: check the middle and throw away half at each step. O(log n): a million items in about 20 steps.
מופיע לראשונה: First appears: מפגשSession 42חלוקה של שלמיםinteger divisioninteger divisionחלוקה של שלמים
כששני המספרים שלמים, / זורק את מה שאחרי הנקודה: 7 / 2 הוא 3. ה-% נותן את השארית: 7 % 2 הוא 1.
When both numbers are whole, / drops what's after the point: 7 / 2 is 3. % gives the remainder: 7 % 2 is 1.
מופיע לראשונה: First appears: מפגשSession 1חריגה (exception)exceptionexceptionחריגה (exception)
בעיה שקורית בזמן ריצה, למשל חלוקה ב-0. אם אף אחד לא מטפל בה, התוכנית עוצרת ומדפיסה Exception in thread "main".
A problem that happens while running, like dividing by 0. If nobody handles it, the program stops and prints Exception in thread "main".
מופיע לראשונה: First appears: מפגשSession 1חריגה checkedchecked exceptionchecked exceptionחריגה checked
חריגה שיורשת מ-Exception (ולא מ-RuntimeException), כמו IOException. javac מחייב לתפוס אותה או להכריז עליה ב-throws. מתאימה למצבים צפויים: קובץ חסר, רשת נפלה.
An exception extending Exception (not RuntimeException), like IOException. javac forces you to catch it or declare it with throws. It fits expected situations: a missing file, a network failure.
חריגה uncheckedunchecked exceptionunchecked exceptionחריגה unchecked
חריגה שיורשת מ-RuntimeException (IllegalArgumentException, NullPointerException). לא חובה להכריז. בדרך כלל מסמנת באג אצל מי שקרא.
An exception extending RuntimeException (IllegalArgumentException, NullPointerException). No declaration required. It usually signals a bug in the caller.
חריגה משלכםcustom exceptioncustom exceptionחריגה משלכם
class BookNotFoundException extends Exception: שם שמסביר את המצב, הודעה ברורה, ושדות נוספים אם צריך.
class BookNotFoundException extends Exception: a name that explains the situation, a clear message, and extra fields if needed.
טיפוסtypetypeטיפוס
מה מותר לשים בקופסה: מספר שלם, מספר עשרוני, טקסט ועוד. המהדר בודק שלא מערבבים.
What may go into a box: a whole number, a decimal, text and more. The compiler checks you don't mix them up.
מופיע לראשונה: First appears: מפגשSession 2טיפוס מוגבלbounded typebounded typeטיפוס מוגבל
<T extends Comparable<T>>: T יכול להיות רק טיפוס שיודע להשוות את עצמו, ולכן מותר לקרוא ל-compareTo.
<T extends Comparable<T>>: T can only be a type that can compare itself, so calling compareTo is allowed.
טיפוס סטטיstatic typestatic typeטיפוס סטטי
הטיפוס של המשתנה, כפי שכתוב בקוד (Item b). javac מרשה לקרוא רק למתודות שקיימות בטיפוס הזה.
The variable's type as written in the code (Item b). javac lets you call only methods that exist in that type.
טיפוס עוטףwrapper typewrapper typeטיפוס עוטף
גרסת עצם של טיפוס פרימיטיבי: Integer ל-int, Double ל-double. אוספים מחזיקים רק עצמים, ולכן List<Integer>.
The object version of a primitive type: Integer for int, Double for double. Collections hold only objects, hence List<Integer>.
טיפוס פרימיטיביprimitive typeprimitive typeטיפוס פרימיטיבי
8 הטיפוסים הבסיסיים של Java (int, long, double, boolean, char ועוד). הערך יושב ישר בקופסה, בלי עצם ב-heap.
Java's 8 basic types (int, long, double, boolean, char and more). The value sits right in the box, with no object on the heap.
טעות של אחד (off-by-one)off-by-oneoff-by-oneטעות של אחד (off-by-one)
לולאה שרצה פעם אחת יותר מדי או פחות מדי, לרוב בגלל < במקום <= או התחלה מ-1 במקום מ-0.
A loop that runs one time too many or too few, usually from < instead of <= or starting at 1 instead of 0.
טרמינלterminalterminalטרמינל
חלון שבו מקלידים פקודות טקסט למחשב במקום ללחוץ עם העכבר. ב-Mac נקרא Terminal, וב-Windows משתמשים ב-PowerShell.
A window where you type text commands to the computer instead of clicking. On a Mac it's called Terminal; on Windows we use PowerShell.
מופיע לראשונה: First appears: מפגשSession 1יצרן-צרכןproducer-consumerproducer-consumerיצרן-צרכן
thread אחד (או יותר) מייצר עבודה ושם בתור, ואחרים לוקחים ומעבדים. התור מאזן בין המהירויות.
One thread (or more) produces work into a queue, and others take and process it. The queue balances the speeds.
מופיע לראשונה: First appears: מפגשSession 34ירושהinheritanceinheritanceירושה
class EBook extends Book: ל-EBook יש את כל השדות והמתודות של Book, והיא יכולה להוסיף ולשנות. לכל מחלקה הורה אחד בלבד.
class EBook extends Book: EBook has every field and method of Book, and can add and change. Each class has exactly one parent.
כימוסencapsulationencapsulationכימוס
העצם שומר על הנתונים שלו בעצמו: השדות private, ומבחוץ אפשר לשנות אותם רק דרך מתודות שבודקות שהשינוי חוקי.
The object guards its own data: the fields are private, and from outside they change only through methods that check the change is valid.
מופיע לראשונה: First appears: מפגשSession 15כיסוי מלאexhaustiveexhaustiveכיסוי מלא
switch שמחזיר ערך חייב לכסות כל אפשרות. עם sealed ו-enum javac בודק את זה, ואם הוספתם סוג חדש הוא מראה כל switch שצריך לעדכן.
A switch that returns a value must cover every possibility. With sealed types and enums javac checks this, and when you add a new kind it points to every switch that needs updating.
מופיע לראשונה: First appears: מפגשSession 23לא משתנה (immutable)immutableimmutableלא משתנה (immutable)
עצם שאי אפשר לשנות אחרי שנוצר. String כזה: toUpperCase() לא משנה את המחרוזת, אלא מחזירה חדשה.
An object that can't change once created. A String is like that: toUpperCase() doesn't change the string, it returns a new one.
לוגיקת משחקgame logicgame logicלוגיקת משחק
המצב והכללים של המשחק (מיקום, מהירות, התנגשויות), בלי שום ציור. כשהם במחלקה נפרדת אפשר להריץ ולבדוק אותם בלי חלון.
The game's state and rules (position, speed, collisions), with no drawing at all. In a separate class you can run and test them with no window.
מופיע לראשונה: First appears: מפגשSession 43לולאהlooploopלולאה
קוד שחוזר שוב ושוב: for, while, do-while ו-for-each.
Code that repeats: for, while, do-while and for-each.
לולאה אינסופיתinfinite loopinfinite loopלולאה אינסופית
לולאה שהתנאי שלה אף פעם לא נהיה false, למשל כששוכחים לשנות את המונה.
A loop whose condition never becomes false, for example when you forget to change the counter.
מופיע לראשונה: First appears: מפגשSession 5לולאה מקוננתnested loopnested loopלולאה מקוננת
לולאה בתוך לולאה: על כל סיבוב של החיצונית, הפנימית רצה מההתחלה עד הסוף.
A loop inside a loop: for each round of the outer one, the inner one runs from start to finish.
מופיע לראשונה: First appears: מפגשSession 5לולאת משחקgame loopgame loopלולאת משחק
הלב של כל משחק: שוב ושוב, בערך 60 פעמים בשנייה, מעדכנים את העולם (update) ומציירים אותו (repaint). ב-Swing הכי פשוט עם javax.swing.Timer.
The heart of every game: over and over, about 60 times a second, update the world (update) and draw it (repaint). In Swing the simplest is a javax.swing.Timer.
ליטרלliteralliteralליטרל
ערך שכתוב ישר בקוד: 42, 3.14, true, 'A', "hi".
A value written straight in the code: 42, 3.14, true, 'A', "hi".
למבדהlambdalambdaלמבדה
פונקציה קצרה בלי שם: (a, b) -> a + b. Java הופכת אותה לעצם שמממש functional interface.
A short nameless function: (a, b) -> a + b. Java turns it into an object implementing a functional interface.
מאגר המחרוזות (String pool)string poolstring poolמאגר המחרוזות (String pool)
אזור שבו Java שומרת מחרוזות שנכתבו בקוד (ליטרלים). שני ליטרלים זהים מצביעים לאותו עצם. new String(...) יוצר עצם חדש מחוץ למאגר.
An area where Java keeps strings written in the code (literals). Two equal literals point to the same object. new String(...) makes a new object outside the pool.
מהדר (compiler)compilercompilerמהדר (compiler)
תוכנה שקוראת את כל הקוד, בודקת שהוא תקין, ומתרגמת אותו לשפה אחרת. ב-Java המהדר הוא javac, והוא מתרגם ל-bytecode.
A program that reads all the code, checks it, and translates it into another language. In Java the compiler is javac, and it translates into bytecode.
מופיע לראשונה: First appears: מפגשSession 1מודל שפהlanguage modellanguage modelמודל שפה
תוכנה שמקבלת טקסט (prompt) ומחזירה טקסט. היא יכולה לטעות או להמציא, ולכן הקוד שסביבה בודק את מה שחזר.
Software that takes text (a prompt) and returns text. It can be wrong or make things up, so the code around it checks what came back.
מופיע לראשונה: First appears: מפגשSession 41מונהcountercounterמונה
משתנה שסופר את הסיבובים, בדרך כלל i: מתחיל, נבדק בתנאי, ועולה בסוף כל סיבוב.
A variable that counts the rounds, usually i: it starts, is checked by the condition, and goes up at the end of each round.
מוניטורmonitormonitorמוניטור
המנעול המובנה של כל עצם ב-Java. מתודה synchronized נועלת את this, ומתודה static synchronized נועלת את המחלקה.
The built-in lock every Java object has. A synchronized method locks this, and a static synchronized method locks the class.
מחיקת טיפוסיםtype erasuretype erasureמחיקת טיפוסים
אחרי הקומפילציה List<String> ו-List<Integer> הם אותו List. לכן אי אפשר new T() או instanceof List<String>: בזמן ריצה המידע כבר לא קיים.
After compiling, List<String> and List<Integer> are the same List. So you can't do new T() or instanceof List<String>: at run time the information is gone.
מחלקה (class)classclassמחלקה (class)
תבנית שממנה יוצרים עצמים. ב-Java כל קוד נמצא בתוך מחלקה, ושם הקובץ חייב להיות זהה לשם המחלקה הציבורית.
A blueprint for making objects. In Java all code lives inside a class, and the file name must match the public class's name.
מופיע לראשונה: First appears: מפגשSession 1מחלקה גנריתgeneric classgeneric classמחלקה גנרית
מחלקה עם פרמטר טיפוס: class Box<T>. כל שימוש קובע מה זה T: Box<String>, Box<Integer>.
A class with a type parameter: class Box<T>. Each use decides what T is: Box<String>, Box<Integer>.
מחלקה מופשטתabstract classabstract classמחלקה מופשטת
abstract class Shape: אי אפשר ליצור ממנה עצם (new Shape() לא מתקמפל), רק לרשת ממנה. יכולה להחזיק שדות, בנאים וקוד משותף.
abstract class Shape: you can't make an object of it (new Shape() doesn't compile), only extend it. It can hold fields, constructors and shared code.
מחלקת עזרutility classutility classמחלקת עזר
מחלקה שכל המתודות שלה static, כמו Math ו-Arrays: אוסף כלים, בלי מצב משלה.
A class whose methods are all static, like Math and Arrays: a toolbox with no state of its own.
מחלקת על (הורה)superclass (parent)superclass (parent)מחלקת על (הורה)
המחלקה שממנה יורשים. מחלקה שלא כתוב לה extends יורשת מ-Object.
The class you inherit from. A class without extends inherits from Object.
מחרוזת (String)stringstringמחרוזת (String)
טקסט. ב-Java כותבים מחרוזת בין מירכאות כפולות: "שלום". מה שבמירכאות מוצג כמו שהוא.
Text. In Java a string goes between double quotes: "hello". Whatever is inside the quotes is shown as is.
מופיע לראשונה: First appears: מפגשSession 1מילה (token)tokentokenמילה (token)
חתיכת קלט בין רווחים או שורות. nextInt ו-next קוראים מילה אחת, ו-nextLine קורא שורה שלמה.
A piece of input between spaces or lines. nextInt and next read one token; nextLine reads a whole line.
מכונת מצביםstate machinestate machineמכונת מצבים
המשחק תמיד נמצא במצב אחד מתוך רשימה סגורה (enum State). כל אירוע מועבר לפי המצב, וחלק מהאירועים מעבירים למצב אחר.
The game is always in one state from a closed list (enum State). Each event is handled by the state, and some events move to another state.
מלכודת nextIntthe nextInt trapthe nextInt trapמלכודת nextInt
nextInt קורא את המספר אבל משאיר את ה-Enter. ה-nextLine הבא קורא את השארית הריקה. הפתרון: nextLine() נוסף אחרי nextInt.
nextInt reads the number but leaves the Enter behind. The next nextLine reads that empty leftover. The fix: an extra nextLine() after nextInt.
ממשק ציבוריpublic interfacepublic interfaceממשק ציבורי
המתודות שמחלקה מציעה לעולם (add, find, report). כל השאר פרטי, ואפשר לשנות אותו בלי לשבור את מי שמשתמש במחלקה.
The methods a class offers the world (add, find, report). Everything else is private, and can change without breaking whoever uses the class.
מסגרת (frame)stack framestack frameמסגרת (frame)
בכל קריאה למתודה נוצרת מסגרת חדשה ב-stack עם המשתנים שלה. כשהמתודה חוזרת, המסגרת נמחקת.
Every method call creates a new frame on the stack holding its variables. When the method returns, the frame is removed.
מופיע לראשונה: First appears: מפגשSession 7מספר קסםmagic numbermagic numberמספר קסם
מספר שמופיע בקוד בלי הסבר (0.17, 56). קבוע עם שם (VAT, PASS) מסביר את עצמו ומשתנה במקום אחד.
A number in the code with no explanation (0.17, 56). A named constant (VAT, PASS) explains itself and changes in one place.
מעברtransitiontransitionמעבר
שינוי ממצב למצב בעקבות אירוע: MENU + ENTER → PLAYING. כדאי לצייר אותם כחצים לפני שכותבים קוד.
A change from state to state after an event: MENU + ENTER → PLAYING. Worth drawing as arrows before writing code.
מערךarrayarrayמערך
שורה של תאים צמודים מאותו טיפוס, בגודל קבוע: int[] a = new int[5]; או int[] a = {1, 2, 3};. המערך הוא עצם ב-heap.
A row of cells of the same type, with a fixed size: int[] a = new int[5]; or int[] a = {1, 2, 3};. The array is an object on the heap.
מערך דו-ממדי2D array2D arrayמערך דו-ממדי
מערך של מערכים: int[][] grid = new int[3][4]; הוא 3 שורות ו-4 עמודות. grid[r][c] הוא תא.
An array of arrays: int[][] grid = new int[3][4]; is 3 rows and 4 columns. grid[r][c] is one cell.
מפתח APIAPI keyAPI keyמפתח API
סיסמה שמזהה אתכם מול השירות. שומרים אותה במשתנה סביבה (System.getenv), אף פעם לא בקוד או ב-Git.
A password identifying you to the service. Keep it in an environment variable (System.getenv), never in code or in Git.
מפתח וערךkey and valuekey and valueמפתח וערך
במילון כל מפתח מופיע פעם אחת, ולכל מפתח ערך אחד. put עם מפתח קיים מחליף את הערך.
In a map each key appears once, with one value. put with an existing key replaces the value.
מצב מקשיםkey statekey stateמצב מקשים
במקום להזיז בתוך keyPressed (שחוזר בקפיצות), שומרים אילו מקשים לחוצים, ובכל טיק זזים לפיהם. התנועה חלקה ואפשר כמה מקשים יחד.
Instead of moving inside keyPressed (which repeats in jumps), keep which keys are down, and move by them on every tick. Movement is smooth and several keys work together.
מצבי threadthread statesthread statesמצבי thread
NEW (נוצר), RUNNABLE (רץ או מוכן), BLOCKED/WAITING/TIMED_WAITING (מחכה), TERMINATED (סיים). getState() מחזיר אותו.
NEW (created), RUNNABLE (running or ready), BLOCKED/WAITING/TIMED_WAITING (waiting), TERMINATED (done). getState() returns it.
מרוץ (race condition)race conditionrace conditionמרוץ (race condition)
תוצאה שתלויה בסדר שבו threads רצים. count++ הוא קריאה, חישוב וכתיבה, ושני threads יכולים לקרוא את אותו ערך לפני שמישהו כתב.
A result that depends on the order threads run in. count++ is a read, a calculation and a write, and two threads can read the same value before anyone writes.
משפט (statement)statementstatementמשפט (statement)
הוראה אחת בתוכנית, למשל הדפסה. ב-Java משפט נגמר בנקודה-פסיק ;.
One instruction in a program, like a print. In Java a statement ends with a semicolon ;.
מופיע לראשונה: First appears: מפגשSession 1משתנהvariablevariableמשתנה
קופסה עם שם ששומרת ערך. ב-Java לכל קופסה יש טיפוס קבוע: int age = 15;.
A named box that holds a value. In Java every box has a fixed type: int age = 15;.
מתודהmethodmethodמתודה
פעולה עם שם שמוגדרת בתוך מחלקה, כמו main או println. קוראים לה עם סוגריים.
A named action defined inside a class, like main or println. You call it with parentheses.
מופיע לראשונה: First appears: מפגשSession 1מתודה גנריתgeneric methodgeneric methodמתודה גנרית
מתודה עם פרמטר טיפוס משלה, לפני טיפוס ההחזרה: static <T> T last(List<T> list). javac מסיק את T מהארגומנטים.
A method with its own type parameter, before the return type: static <T> T last(List<T> list). javac infers T from the arguments.
מתודה מופשטתabstract methodabstract methodמתודה מופשטת
abstract double area();: כותרת בלי גוף. כל תת-מחלקה לא מופשטת חייבת לממש אותה, אחרת javac עוצר.
abstract double area();: a header with no body. Every non-abstract subclass must implement it, or javac stops.
מתודת defaultdefault methoddefault methodמתודת default
מתודה עם גוף בתוך interface. כל מי שמממש מקבל אותה, ויכול לדרוס. היא בנויה מהמתודות האחרות של ה-interface.
A method with a body inside an interface. Every implementer gets it, and can override it. It's built from the interface's other methods.
מופיע לראשונה: First appears: מפגשSession 20מתודת יצרןfactory methodfactory methodמתודת יצרן
מתודה static שמחזירה עצם חדש, עם שם שמסביר מה מקבלים: Temperature.ofCelsius(100). לעתים קרובות הבנאי עצמו private.
A static method that returns a new object, with a name explaining what you get: Temperature.ofCelsius(100). Often the constructor itself is private.
מתזמןschedulerschedulerמתזמן
החלק במערכת ההפעלה שמחליט איזה thread רץ עכשיו ולכמה זמן. ההחלטות שלו לא צפויות, ולכן הסדר בין threads משתנה בין הרצות.
The part of the OS deciding which thread runs now and for how long. Its decisions are unpredictable, so the order between threads changes between runs.
מופיע לראשונה: First appears: מפגשSession 31נקודת עצירהbreakpointbreakpointנקודת עצירה
נקודה אדומה שמסמנים בלחיצה ליד מספר השורה. בהרצת Debug התוכנית נעצרת לפני השורה הזאת.
A red dot you set by clicking next to a line number. In a Debug run the program stops before that line.
מופיע לראשונה: First appears: מפגשSession 11נקודת קצהendpointendpointנקודת קצה
שילוב של שיטה וכתובת שהשרת עונה לו, למשל GET /books/{title}.
A method-and-address pair the server answers, e.g. GET /books/{title}.
נראותvisibilityvisibilityנראות
כל מעבד עובד עם עותקים שמורים (cache), וה-JIT יכול להעביר קריאה אל מחוץ ללולאה. בלי סנכרון, thread עלול להמשיך לראות ערך ישן לנצח.
Each CPU works with cached copies, and the JIT can move a read out of a loop. Without synchronization, a thread may keep seeing an old value forever.
מופיע לראשונה: First appears: מפגשSession 33סביבת פיתוח (IDE)IDEIDEסביבת פיתוח (IDE)
Integrated Development Environment: תוכנה לכתיבת קוד שכוללת עורך, הרצה, דיבוג והשלמה אוטומטית במקום אחד.
Integrated Development Environment: a program for writing code with an editor, running, debugging and autocomplete in one place.
מופיע לראשונה: First appears: מפגשSession 1סדר האתחולinitialization orderinitialization orderסדר האתחול
ב-new: כל השדות מקבלים 0, null או false, אחר כך רצים האתחולים שליד השדות (int a = 5;), ורק אז גוף הבנאי.
On new: every field gets 0, null or false, then the initializers next to the fields run (int a = 5;), and only then the constructor body.
סדר נעילהlock orderinglock orderingסדר נעילה
אם כולם נועלים מנעולים באותו סדר (למשל לפי id), מעגל המתנה לא יכול להיווצר.
If everyone takes locks in the same order (say by id), a waiting cycle can't form.
מופיע לראשונה: First appears: מפגשSession 38סוגריים משולשים <>angle brackets <>angle brackets <>סוגריים משולשים <>
אומרים מה יש בתוך האוסף: List<String> היא רשימה של מחרוזות. המהדר לא ייתן להכניס משהו אחר.
They say what's inside the collection: List<String> is a list of strings. The compiler won't let anything else in.
סיבה (cause)causecauseסיבה (cause)
new DataException("line 2 bad", e) עוטף את החריגה המקורית. getCause() מחזיר אותה, וה-stack trace מראה את שתיהן.
new DataException("line 2 bad", e) wraps the original exception. getCause() returns it, and the stack trace shows both.
סיבוב (איטרציה)iterationiterationסיבוב (איטרציה)
פעם אחת שבה גוף הלולאה רץ.
One time the loop body runs.
מופיע לראשונה: First appears: מפגשSession 5סיבוכיות (O גדול)complexity (big O)complexity (big O)סיבוכיות (O גדול)
כמה העבודה גדלה כשהאוסף גדל. contains ב-ArrayList הוא O(n) (עובר על הכול), ב-HashSet O(1) בממוצע, וב-TreeSet O(log n).
How the work grows as the collection grows. contains on an ArrayList is O(n) (it scans everything), on a HashSet O(1) on average, and on a TreeSet O(log n).
עצלותlazinesslazinessעצלות
פעולות ביניים לא רצות עד שיש פעולת סיום, ו-Stream אפשר להריץ פעם אחת בלבד. פעם שנייה: IllegalStateException: stream has already been operated upon or closed.
Intermediate operations don't run until there's a terminal operation, and a Stream can run once only. A second time: IllegalStateException: stream has already been operated upon or closed.
עצםobjectobjectעצם
מופע של מחלקה: new Book() יוצר עצם חדש ב-heap, עם עותק משלו של כל השדות.
An instance of a class: new Book() creates a new object on the heap, with its own copy of every field.
עצם בלתי משתנהimmutable objectimmutable objectעצם בלתי משתנה
עצם שלא משתנה אחרי שנוצר: כל השדות private final, ו"שינוי" מחזיר עצם חדש (כמו String). בטוח לשתף אותו.
An object that never changes after it's made: every field private final, and a "change" returns a new object (like String). Safe to share.
ערך החזרהreturn valuereturn valueערך החזרה
התשובה שמתודה מחזירה עם return. הטיפוס שלה כתוב לפני שם המתודה.
The answer a method hands back with return. Its type is written before the method name.
פולימורפיזםpolymorphismpolymorphismפולימורפיזם
"הרבה צורות": קוד שכתוב מול טיפוס ההורה (Item) עובד עם כל תת-מחלקה, וכל עצם מתנהג לפי הסוג האמיתי שלו.
"Many forms": code written against the parent type (Item) works with every subclass, and each object behaves according to its real type.
פירוק recordrecord patternrecord patternפירוק record
case Rect(double w, double h) -> מפרק את ה-record לשדות שלו ישר בתוך ה-case.
case Rect(double w, double h) -> takes the record apart into its fields right in the case.
פלטoutputoutputפלט
מה שהתוכנית מציגה החוצה, בדרך כלל על המסך.
What the program shows out, usually on the screen.
מופיע לראשונה: First appears: מפגשSession 1פעולת בינייםintermediate operationintermediate operationפעולת ביניים
פעולה שמחזירה Stream חדש: filter, map, sorted, distinct, flatMap. לבד היא לא מריצה כלום.
An operation returning a new Stream: filter, map, sorted, distinct, flatMap. On its own it runs nothing.
פעולת סיוםterminal operationterminal operationפעולת סיום
הפעולה שמריצה את כל הפס ומחזירה תוצאה: toList, count, sum, collect, findFirst, forEach. אחריה ה-Stream סגור.
The operation that runs the whole line and returns a result: toList, count, sum, collect, findFirst, forEach. After it the Stream is closed.
פקודהcommandcommandפקודה
הוראה אחת שמקלידים בטרמינל ולוחצים Enter, למשל javac Main.java או java --version.
One instruction typed in the terminal followed by Enter, for example javac Main.java or java --version.
מופיע לראשונה: First appears: מפגשSession 1פרמטרparameterparameterפרמטר
משתנה בהגדרת המתודה שמקבל ערך מבחוץ: ב-int add(int a, int b), a ו-b הם פרמטרים.
A variable in the method's definition that receives a value from outside: in int add(int a, int b), a and b are parameters.
פרמטר טיפוסtype parametertype parameterפרמטר טיפוס
השם בסוגריים המשולשים (T, A, B, K, V). בתוך המחלקה הוא מתנהג כמו טיפוס רגיל.
The name in angle brackets (T, A, B, K, V). Inside the class it acts like a normal type.
צוברaccumulatoraccumulatorצובר
משתנה שאוסף תוצאה לאורך הלולאה, כמו sum += i. מאתחלים אותו לפני הלולאה.
A variable that gathers a result through the loop, like sum += i. Initialize it before the loop.
צעד זמן קבועfixed timestepfixed timestepצעד זמן קבוע
צוברים את זמן הפריימים, ומריצים עדכון של, נניח, 20ms בכל פעם שהצטבר מספיק. הפיזיקה יציבה וזהה בכל מחשב.
Accumulate frame time, and run an update of, say, 20ms each time enough has built up. Physics stays stable and identical on every computer.
מופיע לראשונה: First appears: מפגשSession 47קבועconstantconstantקבוע
static final: ערך אחד למחלקה שאי אפשר לשנות. נהוג לכתוב באותיות גדולות: static final double VAT = 0.17;.
static final: one value per class that can't change. Usually written in capitals: static final double VAT = 0.17;.
קובץ .class.class file.class fileקובץ .class
הקובץ שהמהדר יוצר מקובץ .java. הוא מכיל bytecode, ולא נועד לקריאה של בני אדם.
The file the compiler makes from a .java file. It holds bytecode and isn't meant for people to read.
מופיע לראשונה: First appears: מפגשSession 1קודcodecodeקוד
הטקסט שאנחנו כותבים בשפת תכנות. "לכתוב קוד" זה לכתוב תוכנית.
The text we write in a programming language. "Writing code" means writing a program.
מופיע לראשונה: First appears: מפגשSession 1קוד סטטוסstatus codestatus codeקוד סטטוס
מספר בתשובת HTTP: 200 הצליח, 201 נוצר, 400 בקשה שגויה, 404 לא נמצא, 500 שגיאת שרת.
A number in an HTTP response: 200 OK, 201 created, 400 bad request, 404 not found, 500 server error.
מופיע לראשונה: First appears: מפגשSession 39קטע קריטיcritical sectioncritical sectionקטע קריטי
קוד שניגש למשהו משותף, ושרק thread אחד צריך להריץ בכל רגע.
Code touching something shared, that only one thread should run at a time.
מופיע לראשונה: First appears: מפגשSession 32קיצור דרך (short-circuit)short-circuitshort-circuitקיצור דרך (short-circuit)
ב-&& אם הצד השמאלי false, Java לא בודקת את הימני (התשובה כבר ידועה). ב-|| אם השמאלי true.
With &&, if the left side is false Java doesn't check the right (the answer is already known). With ||, if the left is true.
קלטinputinputקלט
מה שהמשתמש מקליד לתוכנית בזמן שהיא רצה. בבדיקות כאן, הקלט מוקלד מראש.
What the user types into the program while it runs. In the checks here, the input is typed in advance.
מופיע לראשונה: First appears: מפגשSession 6רגיש לאותיות גדולותcase-sensitivecase-sensitiveרגיש לאותיות גדולות
ב-Java אות גדולה וקטנה הן שונות: System ו-system הן שתי מילים שונות לגמרי.
In Java capital and small letters are different: System and system are two completely different words.
מופיע לראשונה: First appears: מפגשSession 1שגיאת קומפילציהcompile errorcompile errorשגיאת קומפילציה
בעיה שהמהדר javac מוצא לפני שהתוכנית רצה. התוכנית לא תרוץ בכלל עד שמתקנים. ההודעה מתחילה בשם הקובץ ומספר השורה.
A problem the javac compiler finds before the program runs. The program won't run at all until it's fixed. The message starts with the file name and line number.
מופיע לראשונה: First appears: מפגשSession 1שדהfieldfieldשדה
משתנה שמוגדר בתוך מחלקה, מחוץ למתודות. כל עצם מחזיק ערך משלו: a.title, b.title. שדה מספרי מתחיל ב-0, ושדה של עצם ב-null.
A variable defined inside a class, outside the methods. Each object holds its own value: a.title, b.title. A number field starts at 0, an object field at null.
שיאhigh scorehigh scoreשיא
הניקוד הגבוה ביותר, שנשמר בקובץ כדי שיישאר אחרי שסוגרים את המשחק. שומרים רק אם התוצאה החדשה גבוהה יותר.
The highest score, saved in a file so it stays after the game closes. Save only if the new result is higher.
מופיע לראשונה: First appears: מפגשSession 46שיטה לשאלת ראיוןan interview methodan interview methodשיטה לשאלת ראיון
מבינים את השאלה ושואלים על מקרי קצה, פותרים קודם בדרך הפשוטה, אומרים את הסיבוכיות, משפרים (לרוב עם HashMap או מיון), ובודקים על דוגמה.
Understand the question and ask about edge cases, solve it the simple way first, state the complexity, improve (often with a HashMap or sorting), and test on an example.
מופיע לראשונה: First appears: מפגשSession 42שכבותlayerslayersשכבות
controller מדבר HTTP (בקשה ותשובה), service מחזיק את הכללים, ו-repository שומר נתונים. כל שכבה מדברת רק עם זו שמתחתיה.
The controller speaks HTTP (request and response), the service holds the rules, and the repository stores data. Each layer talks only to the one below.
מופיע לראשונה: First appears: מפגשSession 40שני מצביעיםtwo pointerstwo pointersשני מצביעים
שני אינדקסים שזזים על המערך (מהקצוות פנימה, או אחד אחרי השני). פותר הרבה שאלות ב-O(n) במקום O(n²).
Two indexes moving over the array (from the ends inward, or one behind the other). Solves many questions in O(n) instead of O(n²).
מופיע לראשונה: First appears: מפגשSession 42שפת תכנותprogramming languageprogramming languageשפת תכנות
שפה עם חוקים מדויקים (תחביר) שבה כותבים הוראות למחשב. Java היא שפת תכנות אחת מתוך הרבה.
A language with exact rules (syntax) for writing instructions to a computer. Java is one programming language among many.
מופיע לראשונה: First appears: מפגשSession 1שרשור בנאיםconstructor chainingconstructor chainingשרשור בנאים
this(...) בשורה הראשונה של בנאי קורא לבנאי אחר של אותה מחלקה. כך כותבים את האתחול פעם אחת, ובנאים קצרים מוסיפים ברירות מחדל.
this(...) on a constructor's first line calls another constructor of the same class. That way the setup is written once, and short constructors add defaults.
שתי הפניות לאותו עצםaliasingaliasingשתי הפניות לאותו עצם
int[] b = a; לא מעתיק את המערך: b מצביע על אותו מערך. שינוי דרך b נראה גם דרך a. להעתקה: a.clone().
int[] b = a; doesn't copy the array: b points to the same array. A change through b shows through a too. To copy: a.clone().
תבנית עיצובformat specifierformat specifierתבנית עיצוב
החלקים שמתחילים ב-% ב-printf וב-String.format: %s טקסט, %d שלם, %.2f עשרוני, %5d רוחב 5, %-10s צמוד לשמאל.
The % parts in printf and String.format: %s text, %d whole number, %.2f decimal, %5d width 5, %-10s left-aligned.
תו בריחהescape sequenceescape sequenceתו בריחה
לוכסן הפוך ואחריו תו, שיחד הם תו מיוחד: \n שורה חדשה, \t טאב, \" מירכאות, \\ לוכסן.
A backslash plus a character that together mean a special character: \n new line, \t tab, \" a quote, \\ a backslash.
תוכניתprogramprogramתוכנית
רשימה של הוראות שהמחשב מבצע לפי הסדר. ב-Java תוכנית מתחילה תמיד במתודה main.
A list of instructions the computer carries out in order. In Java a program always starts at the main method.
מופיע לראשונה: First appears: מפגשSession 1תחבירsyntaxsyntaxתחביר
החוקים של איך כותבים בשפה: איפה שמים סוגריים, נקודה-פסיק ומירכאות. טעות תחביר נתפסת כבר בקומפילציה.
The rules of how to write in the language: where brackets, semicolons and quotes go. A syntax mistake is caught at compile time.
מופיע לראשונה: First appears: מפגשSession 1תחום (scope)scopescopeתחום (scope)
האזור בקוד שבו משתנה קיים: משתנה שהוגדר בתוך מתודה או בלוק נעלם בסוף שלהם.
The part of the code where a variable exists: a variable declared in a method or block disappears at its end.
מופיע לראשונה: First appears: מפגשSession 7תכנותprogrammingprogrammingתכנות
כתיבת הוראות מדויקות למחשב בשפה שהוא יודע לבצע, כדי שיפתור בעיה או יעשה משימה.
Writing precise instructions for a computer, in a language it can run, so that it solves a problem or does a task.
מופיע לראשונה: First appears: מפגשSession 1תמונת מצבsnapshotsnapshotתמונת מצב
עותק בלתי משתנה של העולם (record עם List.copyOf). ה-thread של הלוגיקה בונה חדש בכל טיק ומפרסם דרך volatile; ה-render תמיד רואה עולם שלם, אף פעם לא חצי.
An immutable copy of the world (a record with List.copyOf). The logic thread builds a new one each tick and publishes it through volatile; the renderer always sees a whole world, never half of one.
תנאיconditionconditionתנאי
שאלה של כן או לא שהתוכנית בודקת, למשל age >= 18. התשובה היא true או false.
A yes-or-no question the program checks, like age >= 18. The answer is true or false.
תשובה מוקלטתrecorded replyrecorded replyתשובה מוקלטת
מימוש של ה-interface שמחזיר תשובות קבועות מראש. כך בודקים את הקוד בלי רשת, בלי עלות ובלי תוצאות משתנות.
An implementation of the interface returning answers fixed in advance. That way you test the code with no network, no cost and no changing results.
מופיע לראשונה: First appears: מפגשSession 41