❓ التعامل مع الاستثناءات في finally
Try-catch-finally order
Try-catch-finally order
try {
int x = 1 / 0;
System.out.print("A");
} catch (ArithmeticException e) {
System.out.print("B");
} finally {
System.out.print("C");
}❓ الاستثناءات المُتَحَقَّقة (Checked)
Checked exceptions handling
Checked exceptions handling
void read() throws java.io.IOException {}
void m(){ read(); }
جافا Java
❓ الاستثناءات المُتَحَقَّقة (Checked) Checked exceptions handlingvoid read() throws java.io.IOException {} void m(){ read(); }
Choose your answer:
Anonymous Quiz
36%
Compiles: unchecked exceptions only
50%
Does not compile: must handle or declare the checked exception
14%
Runtime error only
❓ تفضيل التحويلات في Overload
Overload preference (widening vs boxing vs varargs)
Overload preference (widening vs boxing vs varargs)
static void m(long x){ System.out.print("long"); }
static void m(Integer x){ System.out.print("Integer"); }
static void m(int... x){ System.out.print("varargs"); }
m(5);❓ ترتيب التهيئة: static ثم instance ثم constructor
Initialization order
Initialization order
class X {
static { System.out.print("S"); }
{ System.out.print("I"); }
X(){ System.out.print("C"); }
}
new X();❓ إخفاء الحقول (Field Hiding)
Field hiding resolution
Field hiding resolution
class A { int v = 1; }
class B extends A { int v = 2; }
B b = new B();
System.out.println(((A)b).v);❓ استخدام this للإشارة لحقل مُغَطّى
Using this to refer to a shadowed field
Using this to refer to a shadowed field
class T {
int n = 10;
void set(int n){ n = n; }
int get(){ return n; }
}
T t = new T();
t.set(5);
System.out.println(t.get());❤1
Enjoy our content? Advertise on this channel and reach a highly engaged audience! 👉🏻
It's easy with Telega.io. As the leading platform for native ads and integrations on Telegram, it provides user-friendly and efficient tools for quick and automated ad launches.
⚡️ Place your ad here in three simple steps:
1 Sign up
2 Top up the balance in a convenient way
3 Create your advertising post
If your ad aligns with our content, we’ll gladly publish it.
Start your promotion journey now!
It's easy with Telega.io. As the leading platform for native ads and integrations on Telegram, it provides user-friendly and efficient tools for quick and automated ad launches.
⚡️ Place your ad here in three simple steps:
1 Sign up
2 Top up the balance in a convenient way
3 Create your advertising post
If your ad aligns with our content, we’ll gladly publish it.
Start your promotion journey now!
❓ ما ناتج الجمع مع break؟
What is the output with break?
What is the output with break?
int sum = 0;
for (int i = 1; i <= 5; i++) {
if (i == 4) break;
sum += i;
}
System.out.println(sum);
❓ do-while تُنفَّذ مرة على الأقل
do-while runs at least once
do-while runs at least once
int i = 5;
do { i++; } while (i < 5);
System.out.println(i);