جافا Java
Відкрити в Telegram
ليس عيبًا ألا تعرف شيئًا، ولكن العيب انك لا تريد أن تتعلم
Показати більше6 098
Підписники
+224 години
-87 днів
-3430 днів
Архів дописів
6 097
❓ التعامل مع الاستثناءات في finally
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");
}6 097
❓ الوراثة مع مُنشئ أب مُعَلَّم
Inheritance with parameterized base constructor
class Base { Base(int x) {} }
class Child extends Base { }6 097
❓ ماذا يطبع جمع عناصر ArrayList؟
What does this ArrayList code print?
import java.util.*;
List<Integer> xs = new ArrayList<>();
xs.add(1);
xs.add(2);
System.out.println(xs.get(0) + xs.get(1));6 097
❓ أي عبارة صحيحة عن String و StringBuilder؟
Which is true about String vs StringBuilder?
6 097
❓ equals مقابل == مع السلاسل
equals vs == with Strings
String s1 = new String("java");
String s2 = new String("java");
System.out.println(s1.equals(s2) + "," + (s1 == s2));6 097
❓ instanceof مع الوراثة
instanceof with inheritance
class A {}
class B extends A {}
A x = new A();
System.out.println(x instanceof B);6 097
❓ تعدد الأشكال (Polymorphism)
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());6 097
❓ استخدام super في 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());