❓ ما ناتج حساب المضروب البسيط؟
What does this factorial-like loop print?
What does this factorial-like loop print?
int n = 3, r = 1;
for (int i = 1; i <= n; i++) r *= i;
System.out.println(r);
❓ تأثير العامل الثلاثي مع الزيادات؟
Ternary with increments effect?
Ternary with increments effect?
int a = 1, b = 2;
int x = (a++ > 1) ? a : b++;
System.out.println(a + "," + b + "," + x);
❓ ما ناتج بناء السلسلة داخل لوب؟
What does this string build print?
What does this string build print?
String s = "a";
for (int i = 0; i < 3; i++) s += i;
System.out.println(s);
🤩1
❓ ما طول الصف الثاني؟
What is the length of the second row?
What is the length of the second row?
int[][] m = { {1,2}, {3,4,5} };
System.out.println(m[1].length);❓ ما مجموع التأثير في switch مع default؟
Total effect in switch with default?
Total effect in switch with default?
int x = 0;
int v = 3;
switch (v) {
case 1: x += 1; break;
case 2:
case 3: x += 3;
default: x += 5; break;
}
System.out.println(x);
❓ ما قيمة الحقل بعد إنشاء الكائن؟
What is the field value after object creation?
What is the field value after object creation?
class A { int v = 1; A(){ v *= 2; } }
A a = new A();
System.out.println(a.v);❤1
❓ أي عبارة صحيحة عن Overloading/Overriding؟
Which statement is true about overloading/overriding?
Which statement is true about overloading/overriding?
جافا Java
❓ أي عبارة صحيحة عن Overloading/Overriding؟ Which statement is true about overloading/overriding?
❓ ما ناتج التعامل مع static مقابل instance؟
What prints for static vs instance fields?
What prints for static vs instance fields?
class C { static int s=0; int i=0; C(){ s++; i++; } }
C a = new C();
C b = new C();
System.out.println(C.s + "," + b.i);❓ ما أقل معدِّل وصول يسمح لوريث في حزمة مختلفة؟
What is the least permissive modifier that still allows a subclass in a different package to access a member?
What is the least permissive modifier that still allows a subclass in a different package to access a member?
❓ سَلسَلة المُنشئات باستخدام this
Constructor chaining with this
Constructor chaining with this
class P {
int x;
P(){ this(5); }
P(int x){ this.x = x; }
}
System.out.println(new P().x);