جافا Java
6.46K subscribers
212 photos
18 videos
81 files
269 links
ليس عيبًا ألا تعرف شيئًا، ولكن العيب انك لا تريد أن تتعلم
Download Telegram
How do you write an if-else statement to check if a variable `age` is greater than 18?
Anonymous Quiz
72%
if (age > 18) {} else {}
3%
if age > 18 {} else {}
18%
if (age > 18); else;
6%
if {age > 18} else {}
2👍1
What will be the output of the following Java code snippet that demonstrates the use of the 'instanceof' keyword?

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



ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي توضح استخدام كلمة 'instanceof'؟
What is the output of the following Java code snippet?

String name = "Java";
System.out.println(name instanceof String);



ما هو مخرج الشفرة البرمجية جافا التالية؟
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);
}



أصلح الخطأ في الشفرة البرمجية جافا التالية لحساب عامل رقم باستخدام العودية بشكل صحيح.
What is the base class of all classes in Java?
Anonymous Quiz
54%
Main
32%
Object
12%
Class
2%
System
What is the output of the following Java code snippet demonstrating the use of a for-each loop?

int[] numbers = {1, 2, 3, 4, 5};
for(int num : numbers) {
System.out.print(num + " ");
}



ما هو مخرج الشفرة البرمجية جافا التالية التي توضح استخدام حلقة for-each؟
Which of these is the correct way to define a constructor that takes a string and an integer as arguments in a class named `Person` in Java?
Anonymous Quiz
60%
Person(String name, int age) {}
21%
void Person(String name, int age) {}
11%
new Person(String name, int age) {}
7%
Person(String name; int age) {}
👍2
What will be the output of the following Java code snippet demonstrating the use of abstract classes?

abstract class Shape {
abstract void draw();
}
class Rectangle extends Shape {
void draw() {
System.out.println("Drawing Rectangle");
}
}
public class Test {
public static void main(String[] args) {
Shape shape = new Rectangle();
shape.draw();
}
}



ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي توضح استخدام الصفوف المجردة؟
اكتب البرنامج
👍1
In Java, which keyword is used to inherit properties and methods from another class?
Anonymous Quiz
76%
extends
9%
implements
9%
inherits
6%
super
What will be the output of the following Java program that demonstrates the concept of inheritance?

class Animal {
String sound() { return "Some sound"; }
}
class Dog extends Animal {
String sound() { return "Bark"; }
}
public class TestInheritance {
public static void main(String[] args) {
Animal myDog = new Dog();
System.out.println(myDog.sound());
}
}



ماذا سيكون المخرج للبرنامج جافا التالي الذي يوضح مفهوم الوراثة؟
جافا Java
اكتب البرنامج
اكتب البرنامج
للمزيد
1👍1🎉1
How do you declare a method that does not return any value?
Anonymous Quiz
71%
void methodName() {}
15%
public methodName() {}
3%
methodType methodName() {}
11%
None of the above
👍1
Correct the error in the following Java code snippet that defines a method to calculate the sum of two integers.

public int sum(int a, int b) {
return a + b
}



صحح الخطأ في الشفرة البرمجية جافا التالية التي تعرف طريقة لحساب مجموع عددين صحيحين.
What keyword is used to import a package in Java?
Anonymous Quiz
27%
package
63%
import
8%
include
2%
use
1
Fix the error in the following code snippet that defines a class and tries to create an object of it.

public class Bike {
int speedLimit = 90;
}
public class TestBike {
public static void main(String[] args) {
Bike myBike = new Bike();
System.out.println(myBike.speedLimit);
}
}



صحح الخطأ في الشفرة البرمجية التالية التي تعرف صفا وتحاول إنشاء كائن منه.
1
What will be the output of the following Java code snippet that uses a switch-case statement?

char grade = 'A';
switch(grade) {
case 'A':
System.out.println("Excellent");
break;
case 'B':
System.out.println("Good");
break;
default:
System.out.println("Invalid grade");
}



ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي تستخدم جملة switch-case؟