ru
Feedback
جافا Java

جافا Java

Открыть в Telegram

ليس عيبًا ألا تعرف شيئًا، ولكن العيب انك لا تريد أن تتعلم

Больше
6 166
Подписчики
-324 часа
-147 дней
-6930 дней
Архив постов
What is the output of the following Java code snippet using polymorphism?
class Animal {
    void sound() {
        System.out.println("Animal makes a sound");
    }
}
class Dog extends Animal {
    void sound() {
        System.out.println("Woof");
    }
}
public class Test {
    public static void main(String[] args) {
        Animal myAnimal = new Dog();
        myAnimal.sound();
    }
}
ما هو مخرج الشفرة البرمجية جافا التالية باستخدام الشكلية البوليمورفية؟

What is the default value of a boolean variable in Java?
Anonymous voting

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();
    }
}
ماذا سيكون المخرج للشفرة البرمجية جافا التالية التي توضح استخدام المتغيرات الثابتة؟

How do you increment a variable `x` by 1 in Java?
Anonymous voting

Correct the error in the following Java code snippet to properly encapsulate the 'name' field.
class Person {
    public String name; // This should be encapsulated
    public String getName() {
        return name;
    }
    public void setName(String newName) {
        this.name = newName;
    }
}
صحح الخطأ في الشفرة البرمجية جافا التالية لتغليف حقل 'name' بشكل صحيح.

Which of the following is a valid Java statement to check if 'x' is either 10 or 20?
Anonymous voting

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();
    }
}
ما هو مخرج الشفرة البرمجية جافا التالية التي توضح مفهوم إعادة تعريف الطريقة؟

How do you define an interface in Java?
Anonymous voting

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();
    }
}
حدد وصحح الخطأ في الشفرة البرمجية جافا التالية لتوضيح الاستخدام الصحيح للصف المجرد.

Which keyword is used in Java to create a new instance of a class?
Anonymous voting

Which keyword is used by the method to refer to the object that invoked it?
Anonymous voting

Which of the following is a valid declaration of an object of class Box?
Anonymous voting

Which concept of Java is a way of converting real world objects in terms of class?
Anonymous voting

Which of the following is not OOPS concept in Java?
Anonymous voting

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();
    }
}
ما هو مخرج الشفرة البرمجية جافا التالية التي توضح مفهوم إعادة تعريف الطريقة؟

Which of the following is not a valid way to create an instance of a class named `MyClass` in Java?
Anonymous voting

Consider the following Java code snippet. What will be the output?
class Base {
    void display() {
        System.out.println("Base display()");
    }
}
class Derived extends Base {
    void display() {
        System.out.println("Derived display()");
    }
}
public class Test {
    public static void main(String[] args) {
        Base obj = new Derived();
        obj.display();
    }
}
فكر في الشفرة البرمجية جافا التالية. ماذا سيكون المخرج؟

What is the output of the following Java code? ```java System.out.println(10 > 9); ```
Anonymous voting

In Java, what is a 'package' and how is it used? في جافا، ما هو 'الحزمة' وكيف يتم استخدامها؟