❓ أي استدعاء يُفضَّل مع varargs؟
Which overload is chosen with varargs?
Which overload is chosen with varargs?
static void m(int x) { System.out.print("exact"); }
static void m(int... x) { System.out.print("varargs"); }
m(5);❓ ما نتيجة البحث بعد الفرز؟
What is binarySearch result after sort?
What is binarySearch result after sort?
int[] a = {3, 1, 2};
java.util.Arrays.sort(a);
System.out.println(java.util.Arrays.binarySearch(a, 2));👍1
❓ ما ناتج حساب المضروب البسيط؟
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);
❓ ما طول الصف الثاني؟
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);
❤3
❓ ما قيمة الحقل بعد إنشاء الكائن؟
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);❓ أي عبارة صحيحة عن 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);