❓ ما طول الصف الثاني؟
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);❓ استخدام super في override
Using super in an override
Using super in an override
class A { String f(){ return "A"; } }
class B extends A { String f(){ return super.f() + "B"; } }
System.out.println(new B().f());❓ تعدد الأشكال (Polymorphism)
Polymorphism dispatch
Polymorphism dispatch
class A { String f(){ return "A"; } }
class B extends A { String f(){ return "B"; } }
A x = new B();
System.out.println(x.f());❓ instanceof مع الوراثة
instanceof with inheritance
instanceof with inheritance
class A {}
class B extends A {}
A x = new A();
System.out.println(x instanceof B);❓ equals مقابل == مع السلاسل
equals vs == with Strings
equals vs == with Strings
String s1 = new String("java");
String s2 = new String("java");
System.out.println(s1.equals(s2) + "," + (s1 == s2));