What does the `final` keyword signify when applied to a variable in Java?
Anonymous Quiz
20%
The variable can be initialized only once.
4%
The value of the variable can change at runtime.
29%
The variable is a constant.
46%
Both A and C are correct.
Correct the error in the following Java code snippet that attempts to override a method in a subclass.
صحح الخطأ في الشفرة البرمجية جافا التالية التي تحاول إعادة تعريف طريقة في فئة فرعية.
class SuperClass {
protected void display() {
System.out.println("SuperClass display");
}
}
class SubClass extends SuperClass {
private void display() {
System.out.println("SubClass display");
}
}
صحح الخطأ في الشفرة البرمجية جافا التالية التي تحاول إعادة تعريف طريقة في فئة فرعية.
https://t.me/java_coffee1
رابط القروب تتناقش فيه مواضيع تقنيه غير الجافا علشان مانطلع من هذا القروب عن الجافا
رابط القروب تتناقش فيه مواضيع تقنيه غير الجافا علشان مانطلع من هذا القروب عن الجافا
👍3❤1🔥1
What keyword is used to access a method or variable from the superclass in a subclass?
Anonymous Quiz
61%
super
14%
this
19%
extends
6%
parent
Identify and fix the error in the following Java code snippet that defines an enum for days of the week.
حدد وأصلح الخطأ في الشفرة البرمجية جافا التالية التي تعرف enum لأيام الأسبوع.
enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY;
}
حدد وأصلح الخطأ في الشفرة البرمجية جافا التالية التي تعرف enum لأيام الأسبوع.
Which of the following is a valid declaration of a String variable in Java?
Anonymous Quiz
14%
String name = 'John';
10%
string name = "John";
70%
String name = "John";
6%
Str name = 'John';
❤1
What is the output of the following Java code snippet demonstrating the concept of method overriding?
ما هو مخرج الشفرة البرمجية جافا التالية التي توضح مفهوم إعادة تعريف الطريقة؟
class Vehicle {
void run() {
System.out.println("Vehicle is running");
}
}
class Bike extends Vehicle {
void run() {
System.out.println("Bike is running safely");
}
}
public class Test {
public static void main(String[] args) {
Bike obj = new Bike();
obj.run();
}
}
ما هو مخرج الشفرة البرمجية جافا التالية التي توضح مفهوم إعادة تعريف الطريقة؟
What concept in Java is used to hide the internal implementation details of a class and only show the functionality to the user?
Anonymous Quiz
47%
Encapsulation
16%
Inheritance
9%
Polymorphism
27%
Abstraction
What will be the output of the following Java code snippet that demonstrates the use of a static variable?
ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي توضح استخدام متغير ثابت؟
class Counter {
static int count = 0;
Counter() {
count++;
System.out.println(count);
}
}
public class TestStaticVariable {
public static void main(String[] args) {
new Counter();
new Counter();
}
}
ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي توضح استخدام متغير ثابت؟
👍2
What is the correct way to declare a variable to store an integer value in Java?
Anonymous Quiz
97%
int num;
1%
integer num;
0%
num int;
2%
Int num;
Fix the error in the following Java code snippet to correctly iterate over an array using a for loop.
أصلح الخطأ في الشفرة البرمجية جافا التالية لتكرار على مصفوفة باستخدام حلقة for بشكل صحيح.
int[] arr = {1, 2, 3, 4, 5};
for(int i = 0; i <= arr.length; i++) {
System.out.println(arr[i]);
}
أصلح الخطأ في الشفرة البرمجية جافا التالية لتكرار على مصفوفة باستخدام حلقة for بشكل صحيح.
How do you declare a constant in Java?
Anonymous Quiz
21%
int const value = 100;
63%
final int value = 100;
15%
const int value = 100;
1%
immutable int value = 100;
What will be the output of the following Java code snippet that uses a while loop?
ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي تستخدم حلقة while؟
int x = 0;
while(x < 5) {
System.out.print(x + " ");
x++;
}
ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي تستخدم حلقة while؟
❤2
What will the following code snippet print?
```java
if (false) { System.out.println("True"); } else { System.out.println("False"); } ```
```java
if (false) { System.out.println("True"); } else { System.out.println("False"); } ```
Anonymous Quiz
25%
"True"
35%
"False"
20%
Nothing, it will cause a compile-time error
20%
Nothing, it will cause a runtime error
What will be the output of the following Java code snippet that demonstrates the use of static variables?
ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي توضح استخدام المتغيرات الثابتة؟
class Counter {
static int count = 0;
Counter() {
count++;
System.out.println(count);
}
}
public class TestCounter {
public static void main(String[] args) {
Counter c1 = new Counter();
Counter c2 = new Counter();
Counter c3 = new Counter();
}
}
ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي توضح استخدام المتغيرات الثابتة؟
Which keyword in Java is used to create a subclass from a superclass?
Anonymous Quiz
11%
subclass
70%
extends
9%
implements
10%
inherit
Fix the error in the following Java code snippet to correctly declare and initialize an array of integers.
أصلح الخطأ في الشفرة البرمجية جافا التالية لتعريف وتهيئة مصفوفة من الأعداد الصحيحة بشكل صحيح.
int[] numbers = {1, 2, 3, 4, 5;
أصلح الخطأ في الشفرة البرمجية جافا التالية لتعريف وتهيئة مصفوفة من الأعداد الصحيحة بشكل صحيح.