جافا Java
6.46K subscribers
212 photos
18 videos
81 files
269 links
ليس عيبًا ألا تعرف شيئًا، ولكن العيب انك لا تريد أن تتعلم
Download Telegram
اختر الإجابة الخاطئة لتعريف الدوال في جافا
👏2
Which collection class in Java ensures that elements are sorted?
Anonymous Quiz
61%
ArrayList
12%
HashSet
18%
TreeSet
9%
LinkedList
1🤩1
What will be the output of the following Java code snippet that demonstrates the use of the ternary operator?

int a = 10, b = 5;
int result = (a > b) ? a : b;
System.out.println(result);



ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي توضح استخدام العامل الثلاثي؟
In Java, which operator is used for logical AND operation?
Anonymous Quiz
85%
&&
8%
&
3%
and
3%
||
Fix the error in the following Java code snippet to correctly iterate over an array using a for loop.

int[] arr = {1, 2, 3, 4, 5};
for(int i = 0; i <= arr.length; i++) {
System.out.println(arr[i]);
}



أصلح الخطأ في الشفرة البرمجية جافا التالية لتكرار على مصفوفة باستخدام حلقة for بشكل صحيح.
What is the output of the following code snippet?
```java
int a = 5; int b = 2; System.out.println(a / b); ```
Anonymous Quiz
27%
2.5
62%
2
2%
3
9%
None of the above
Identify and fix the error in the following Java code snippet that tries to implement an abstract method in an interface.

interface Animal {
abstract void eat();
}
class Dog implements Animal {
public void eat() {
System.out.println("Dog eats");
}
}



حدد وأصلح الخطأ في الشفرة البرمجية جافا التالية التي تحاول تنفيذ طريقة مجردة في واجهة.
1👍1
Which of the following is not a loop construct in Java?
Anonymous Quiz
8%
for
3%
while
6%
do-while
83%
repeat-until
Fix the error in the following Java code snippet to correctly calculate the factorial of a number using recursion.

public int factorial(int n) {
if (n == 1)
return 1;
else
return n * factorial(n - 1);
}



أصلح الخطأ في الشفرة البرمجية جافا التالية لحساب عامل رقم باستخدام العودية بشكل صحيح.
1
In Java, which keyword is used to inherit from a class?
Anonymous Quiz
82%
extends
9%
implements
4%
super
6%
this
Correct the error in the following Java code snippet that tries to encapsulate a class property.

class Student {
private int age;
public getAge() {
return age;
}
public void setAge(int age) {
if(age > 0) {
this.age = age;
}
}
}



صحح الخطأ في الشفرة البرمجية جافا التالية التي تحاول تغليف خاصية صف.
What is the result of attempting to compile and run a Java program with a `main` method that does not accept any arguments?
Anonymous Quiz
32%
Compile-time error
26%
Runtime error
21%
The program compiles and runs without issues
21%
The program compiles but does not run
Find and correct the error in the following code snippet to correctly implement encapsulation in Java.

class Student {
private int age;
public void setAge(int age) {
if(age > 0) {
this.age = age;
}
}
public int getAge() {
return age;
}
}



جد وصحح الخطأ في الشفرة البرمجية التالية لتنفيذ التغليف بشكل صحيح في جافا.
Which of the following is a valid declaration of a method that returns an array of integers in Java?
Anonymous Quiz
62%
public int[] getNumbers() {}
26%
public int getNumbers[]() {}
7%
int[] public getNumbers() {}
4%
getNumbers()[] int public {}
What will be the output of the following Java code snippet that demonstrates static method overriding?

class Parent {
static void show() {
System.out.println("Parent's show()");
}
}
class Child extends Parent {
static void show() {
System.out.println("Child's show()");
}
}
public class Test {
public static void main(String[] args) {
Parent obj = new Child();
obj.show();
}
}



ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي توضح إعادة تعريف الطريقة الثابتة؟
كثير من اللي هنا مايعرفون اني انزل اسئله يوميه مثل هذي على تويتر بس مختلفه على الأسئلة اللي هنا 🫢