❓ ملء المصفوفة بـ Arrays.fill
Arrays.fill
Arrays.fill
int[] a = new int[4];
java.util.Arrays.fill(a, 2);
System.out.println(a[3]);
👍1
❓ التحويل التلقائي مع Integer
Autoboxing side effect
Autoboxing side effect
void bump(Integer x){ x++; }
Integer v = 1;
bump(v);
System.out.println(v);❓ Stream على مصفوفة
Stream over array
Stream over array
int[] a = {1,2,3};
int[] b = java.util.Arrays.stream(a).map(x -> x * 2).toArray();
System.out.println(a[1] + "," + b[1]);👍1
❓ ترتيب كتل static مع الوراثة
Static init order with inheritance
Static init order with inheritance
class A { static { System.out.print("A"); } }
class B extends A { static { System.out.print("B"); } }
new B();❓ خطأ فهرسة في حلقة
Index error in loop
Index error in loop
int[] a = {1,2,3};
for (int i = 0; i <= a.length; i++) {
System.out.print(a[i]);
}❓ ما ناتج الكود التالي؟
What is the output of the following code?
What is the output of the following code?
int x = 5;
if (x > 3) x++;
if (x == 6) x += 2;
System.out.println(x);
❓ ما مجموع الأعداد من 1 إلى 3؟
What does this loop print?
What does this loop print?
int sum = 0;
for (int i = 1; i <= 3; i++) {
sum += i;
}
System.out.println(sum);
❓ ما ناتج السويتش بدون break؟
What is the output (no breaks before case 3)?
What is the output (no breaks before case 3)?
int n = 2;
switch (n) {
case 1: System.out.print('A');
case 2: System.out.print('B');
case 3: System.out.print('C'); break;
default: System.out.print('D');
}
Forwarded from قهوة مبرمجين
Transactions_and_Concurrency_Control.pdf
6.3 MB
لو تشتغل على جافا، أنصحك تقرأ آخر إصدار من كتاب “Troubleshooting Java”.
الكتاب مليان أشياء عملية: من أفضل ممارسات الـdebugging، إلى الـlogging، الـtracing، الـtelemetry، نموذج الذاكرة في جافا، منع الـdeadlocks، وكمان الـprofiling والـsampling.
قراءة ممتازة لو تحب تفهم وش يصير تحت غطاء الـJVM وكيف تلاقي المشاكل بسرعة في الإنتاج.
الكتاب مليان أشياء عملية: من أفضل ممارسات الـdebugging، إلى الـlogging، الـtracing، الـtelemetry، نموذج الذاكرة في جافا، منع الـdeadlocks، وكمان الـprofiling والـsampling.
قراءة ممتازة لو تحب تفهم وش يصير تحت غطاء الـJVM وكيف تلاقي المشاكل بسرعة في الإنتاج.
👍1
❓ أي overload يُستدعى؟
Which overload is invoked?
Which overload is invoked?
void print(int x) { System.out.println("int"); }
void print(Integer x) { System.out.println("Integer"); }
Integer n = null;
print(n);❤1
❓ كيف تطبع طول المصفوفة؟
How do you print the array length?
How do you print the array length?
int[] a = {1, 2, 3, 4};
System.out.println( /* ? */ );