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;
أصلح الخطأ في الشفرة البرمجية جافا التالية لتعريف وتهيئة مصفوفة من الأعداد الصحيحة بشكل صحيح.
منصه JetBrains نزلت استبيان اتوقع بيفتحون منصه كورسات اللي يجاوب على الاستبيان فيه جوائز كثيره مثل اللي بالصوره ادخلوا جاوبوا
https://surveys.jetbrains.com/s3/computer-science-learning-curve-survey-sh?pcode=796954345361784390
https://surveys.jetbrains.com/s3/computer-science-learning-curve-survey-sh?pcode=796954345361784390
👍1👎1
Which of these is not a valid reason for using methods in Java?
Anonymous Quiz
27%
To reuse code
15%
To divide a complex problem into simpler ones
45%
To prevent other classes from accessing private fields
13%
To enhance the readability of the code
Identify and correct the error in the following Java code snippet to demonstrate the correct use of an abstract class.
حدد وصحح الخطأ في الشفرة البرمجية جافا التالية لتوضيح الاستخدام الصحيح للصف المجرد.
abstract class Animal {
abstract void eat();
}
class Dog extends Animal {
void eat() {
System.out.println("Dog eats");
}
}
public class TestAnimal {
public static void main(String[] args) {
Animal a = new Dog();
a.eat();
}
}
حدد وصحح الخطأ في الشفرة البرمجية جافا التالية لتوضيح الاستخدام الصحيح للصف المجرد.
👍2
What does the `this` keyword refer to in Java?
Anonymous Quiz
20%
The current method
23%
The current class
49%
The current object
8%
The superclass
What is the output of the following Java code snippet that uses array of objects?
ما هو مخرج الشفرة البرمجية جافا التالية التي تستخدم مصفوفة من الكائنات؟
class Student {
String name;
Student(String name) {
this.name = name;
}
}
public class Test {
public static void main(String[] args) {
Student[] students = {new Student("John"), new Student("Jane")};
for(Student student : students) {
System.out.println(student.name);
}
}
}
ما هو مخرج الشفرة البرمجية جافا التالية التي تستخدم مصفوفة من الكائنات؟
Which of these is a correct example of method overloading in Java?
Anonymous Quiz
26%
A method with the same name but different return types.
60%
Two methods with the same name but different parameter lists in the same class.
8%
Methods with the same name and parameter list in different classes.
5%
Two methods with different names but the same parameter list in the same class.
How do you define an enum in Java?
Anonymous Quiz
59%
enum Color {RED, GREEN, BLUE}
14%
class Color {RED, GREEN, BLUE}
6%
interface Color {RED, GREEN, BLUE}
20%
Array Color = {RED, GREEN, BLUE}
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;
أصلح الخطأ في الشفرة البرمجية جافا التالية لتعريف وتهيئة مصفوفة من الأعداد الصحيحة بشكل صحيح.