Discuss, Learn and be Happy דיון בשאלות

help brightness_4 brightness_7 format_textdirection_r_to_l format_textdirection_l_to_r

באיזו תבנית עיצוב היית עושה שימוש על מנת להתמודד עם הבעיות הטמונות בתרשים המחלקות הבא:

1
done
Decorator pattern suggests giving the client the ability to specify whatever combination of "features" is desired.
by
מיין לפי
by נעם שלו
נעם שלו 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
התנהגות של Window
by

מה הפלט של התוכנית הבאה?

1
done
Explanation: From the statement “thread.start()”, we have two threads Main thread and “thread” thread. So either “GFG” can be printed or “Geeks”, depend on which thread, thread scheduler schedule. For (a), the parent thread after calling start() method is paused and the thread scheduler schedules the child thread which then completes its execution. Following this, the parent thread is scheduled. For (b), the parent thread calls start() method but continues its execution and prints on the console. When join() method is called, the parent thread has to wait for its child to complete its execution. Thread scheduler schedules child thread while the parent waits for the child to complete.
by
מיין לפי

מה הפלט של התוכנית הבאה?

1
done
Explanation: Invoking start() method on a thread moves the thread to a RUNNABLE state. But invoking start() method on a thread that has already started throws a IllegalThreadStateException because the thread is already in RUNNABLE state.
by
מיין לפי
by Omer Laufer
Omer Laufer 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
למה בידוק שגיאה בזמן ריצה?
by
by נעם שלו
נעם שלו 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
כי מבחינת הקומפילציה הפקודה חוקית, אבל ברגע שננסה להפעיל שוב את אותו thread תהיה שגיאה
by

מה הפלט של התוכנית הבאה?

1
done
Explanation: Test class extends Thread class that has start() method implemented. So invoking start() on an object that extends Thread class invokes run() method defined in the program.
by
מיין לפי

מה הפלט של התוכנית הבאה?

1
done
Explanation: An object must first acquire a lock before calling wait() method. Also wait() method throws Checked exception(InterruptedException), we must include it in a try-catch block or throws it.
by
מיין לפי
by Lior Linoi Aftabi
Lior Linoi Aftabi 0 נקודות · יותר מ-6 חודשים
מוניטין: 19
למה זה זורק שגיאה?
by
by Omri Peretz
Omri Peretz 1 נקודות · יותר מ-6 חודשים
מוניטין: 59
אולי כי יש wait בתוך הrun?
by
by Gal Levi
Gal Levi 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
אולי כי קוראים לwait על thread שעוד לא התחיל לרוץ? לא בטוח
by
by Manuel Ruffieux
Manuel Ruffieux 0 נקודות · יותר מ-6 חודשים
מוניטין: 175
יואו רואים שאתה תכשל
by
by Omer Laufer
Omer Laufer 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
מישהו הבין למה?
by
by Lior Linoi Aftabi
Lior Linoi Aftabi 0 נקודות · יותר מ-6 חודשים
מוניטין: 19
יש מצב שזה בגלל שמנסים לעשות notify על obj שהוא משתנה סטטי?
by
by נעם שלו
נעם שלו 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
לדעתי זה בגלל הסטטי אבל תשתפו אם יש תשובה
by
by עמית פרפרה
עמית פרפרה 0 נקודות · יותר מ-6 חודשים
מוניטין: 5
לפי דעתי זה נכשל כי יש notify על אובייקט שלא ממש observer pattern אז אין לו את הפונקציה בכלל
by
by Noa Argamani
Noa Argamani 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
notify זה פונקציה שמעירה thread אחרי שביצעו thread.wait, היא קיימת גם בobserver אבל אני לא חושבת שזאת הכוונה במקרה הזה
by
by עמית פרפרה
עמית פרפרה 0 נקודות · יותר מ-6 חודשים
מוניטין: 5
כן יצאתי ילד
by
by Yael Kanevsky
Yael Kanevsky 1 נקודות · יותר מ-6 חודשים
מוניטין: 18
זה מה שכתוב על השאלה : Explanation: An object must first acquire a lock before calling wait() method. Also wait() method throws Checked exception(InterruptedException), we must include it in a try-catch block or throws it.
by
by Gil Ari Agmon
Gil Ari Agmon 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
unreported exception java.lang.InterruptedException; must be caught or declared to be thrown
by

מה הפלט של התוכנית הבאה?

1
done
Explanation: For (a), the parent thread keep executing until it reaches the barrier. The child thread are then scheduled. For (b), thread scheduler scheduler thread1. Once it reaches the barrier, the parent thread is scheduled. Once parent thread reached the barrier, thread2 is scheduled. For (c), Both the child thread are scheduled. Finally when each of the child threads reach the barrier, the parent thread is scheduled.
by
מיין לפי
by Omer Laufer
Omer Laufer 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
למה זה התשובה?
by
by Guy Biton
Guy Biton 0 נקודות · יותר מ-6 חודשים
מוניטין: 24
נראה לי הכוונה זה שזה יכולה להיות כל אחת מהאופציות, השאלה מי יקבל את הזמן ביצוע קודם על ידי scheduler, אופציה ראשונה אומרת שקודם הmain קיבל ואז 2 הטרדים. אופציה שנייה טרד אחד main ואז טרד נוסף, אופציה שלישית 2 הטרדים ואז ה main
by

איזה Design Pattern נכון להשתמש כאשר אתה מעוניין להפריד בין המימוש לאבסטרקציה?לדוגמה כאשר המימוש צריך להיבחר או להתחלף בזמן ריצה.

1
done
by
מיין לפי
by Manuel Ruffieux
Manuel Ruffieux 3 נקודות · יותר מ-6 חודשים
מוניטין: 175
השאלה גרועה אם מסתכלים על החלק הראשון זה ברידג' ואם על השני זה סטראטג'י...
by
by נעם שלו
נעם שלו 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
מסכימה
by
by Gil Ari Agmon
Gil Ari Agmon 0 נקודות · יותר מ-6 חודשים
מוניטין: 1
אחלה שאלה אחי מה אתה הייטר
by

איזו תבנית עיצוב רצוי להשתמש כאשר יש הרבה מחלקות שונות בהתנהגות שלהן או שיש סוגים שונים של אלגוריתמים בהם אתה מעוניין להשתמש.

1
done
by
מיין לפי

איזו תבנית עיצוב תשתמש כאשר מחלקה רוצה להיות אחראית על יצירת אובייקטים

1
done
by
מיין לפי

באיזו תבנית עיצוב תשתמש כאשר אתה מעוניין לספק ממשק פשוט למערכת מורכבת

1
done
by
מיין לפי