What will the following Java code snippet print?
```java
int[] numbers = {1, 2, 3, 4, 5}; for(int i : numbers) { System.out.print(i + " "); } ```
```java
int[] numbers = {1, 2, 3, 4, 5}; for(int i : numbers) { System.out.print(i + " "); } ```
Anonymous Quiz
56%
1 2 3 4 5
13%
1, 2, 3, 4, 5
8%
12345
23%
An error because the syntax is incorrect
🙏1
In Java, what is a 'stream' and how is it typically used?
في جافا، ما هو 'تيار' وكيف يستخدم عادة؟
في جافا، ما هو 'تيار' وكيف يستخدم عادة؟
What is the output of the following Java code snippet?
```java
int a = 9, b = 4; if (a > 10) { b = b + 1; } else { b = b - 1; } System.out.println(b); ```
```java
int a = 9, b = 4; if (a > 10) { b = b + 1; } else { b = b - 1; } System.out.println(b); ```
Anonymous Quiz
75%
3
14%
4
8%
5
3%
0
How can you ensure a class cannot be subclassed in Java?
Anonymous Quiz
51%
By declaring the class as `final`
26%
By using the `private` access modifier on the class
11%
By not providing any constructors
11%
By declaring all methods as `final`
How can you call a method named `calculateSum` that takes two integers as parameters and returns an integer?
Anonymous Quiz
29%
calculateSum(int a, int b);
28%
int result = calculateSum(a, b);
28%
int result = calculateSum(int a, int b);
16%
calculateSum(a, b);
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
جافا Java
سر نجاح المبرمجين هو الاستمرارية. عندما تواجه تحديات، استمر في العمل، وعندما تحقق إنجازات، استمر في التعلم.
❤5
Which of the following is not a valid way to create a thread in Java?
Anonymous Quiz
27%
By extending the Thread class
22%
By implementing the Runnable interface
31%
By using the ExecutorService
20%
By extending the Runnable interface
True or False: In Java, a 'while' loop is an example of a conditional loop.
صحيح أم خطأ: في جافا، حلقة 'while' هي مثال على حلقة شرطية.
صحيح أم خطأ: في جافا، حلقة 'while' هي مثال على حلقة شرطية.
How do you handle an exception in Java?
Anonymous Quiz
72%
try-catch block
19%
throw-catch block
3%
error-catch block
6%
try-throw block
What is the output of the following Java code?
ما هو مخرجات الكود الجافا التالي؟
int[] arr = {1, 2, 3, 4, 5};
for(int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
} ما هو مخرجات الكود الجافا التالي؟
int[] arr = {1, 2, 3, 4, 5};
for(int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}❤1
What is the return type of a method that does not return any value?
Anonymous Quiz
21%
null
62%
void
8%
0
9%
None of the above
❤1
What is a 'Lambda expression' in Java, and give an example.
ما هو 'تعبير لامبدا' في جافا، وأعط مثالاً.
ما هو 'تعبير لامبدا' في جافا، وأعط مثالاً.
What is the correct way to create a read-only property in a class in Java?
Anonymous Quiz
51%
By using a private field and public getter method
15%
By using a public field
13%
By using a static field
21%
By using a final method
Which of the following is a legal identifier in Java?
Anonymous Quiz
52%
_myVariable
16%
2myVariable
18%
my-variable
14%
my variable
Describe the difference between checked and unchecked exceptions in Java.
وصف الفرق بين الاستثناءات المراقبة وغير المراقبة في جافا.
وصف الفرق بين الاستثناءات المراقبة وغير المراقبة في جافا.