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;
أصلح الخطأ في الشفرة البرمجية جافا التالية لتعريف وتهيئة مصفوفة من الأعداد الصحيحة بشكل صحيح.
لإيجاد طول الصف وطول العمود في المصفوفه الثانية
int[][]matrix = new int[20][15];
int[][]matrix = new int[20][15];
Anonymous Quiz
50%
1:arrayName.length gives the number of rows 2 :arrayName[0].length gives the number of columns.
23%
1:arrayName.length gives the number of columns 2 :arrayName[0].length gives the number of rows.
15%
1:arrayName.length gives the number of rows 2 :arrayName.length gives the number of columns.
13%
1:arrayName.length[0] gives the number of rows 2 :arrayName.length gives the number of columns.
❤1
الى ماذا ترمز هذي الصيغه
public void methodABC(int x,double y)
public void methodABC(double x,int y)
public void methodABC(int x,double y)
public void methodABC(double x,int y)
Anonymous Quiz
45%
Overriding
55%
overload
ماهي وظيفة هذه الدالة
replaceFirst(String regex, String replacement)
replaceFirst(String regex, String replacement)
Anonymous Quiz
46%
تستخدم لتبديل نص محدد بداخل الـ String الذي قام باستدعائها
19%
تستخدم للبحث في الـ String الذي قام باستدعائها عن Substring ما لتبديله بنص جديد
35%
تبحث في الـ String الذي قام باستدعائها عن القيمة الأولى التي نمررها لها و تبدلها بالقيمة الثانية
int c[ ][ ];
هل يمثل مصفوفة ثنائية اذا كانت الإجابة خطأ اعطنا الصح في جروب المناقشة
هل يمثل مصفوفة ثنائية اذا كانت الإجابة خطأ اعطنا الصح في جروب المناقشة
Anonymous Quiz
79%
صح
21%
خطأ
👍3