Author name: admin

Which of the following best describes the concept of inheritance in Java?

Java MCQ: Which of the following best describes the concept of inheritance in Java? a) Inheritance allows a class to inherit methods and fields from multiple classes b) Inheritance allows a class to inherit methods and fields from a single superclass c) Inheritance is not supported in Java d) Inheritance allows a class to override […]

Which of the following best describes the concept of inheritance in Java? Read More »

Which of the following is a feature of the ‘synchronized’ keyword in Java?

Java MCQ: Which of the following is a feature of the ‘synchronized’ keyword in Java? a) It allows multiple threads to access a resource simultaneously b) It prevents multiple threads from accessing a resource simultaneously c) It is used to initialize a thread d) It is used to terminate a thread Answer: b) It prevents

Which of the following is a feature of the ‘synchronized’ keyword in Java? Read More »

Which of the following is true about the ‘finalize()’ method in Java?

Java MCQ: Which of the following is true about the ‘finalize()’ method in Java? a) The ‘finalize()’ method is called to initialize an object b) The ‘finalize()’ method is called by the garbage collector before an object is destroyed c) The ‘finalize()’ method can be overridden to implement object cloning d) The ‘finalize()’ method is

Which of the following is true about the ‘finalize()’ method in Java? Read More »

Which of the following statements about the ‘abstract’ keyword in Java is true?

Java MCQ: Which of the following statements about the ‘abstract’ keyword in Java is true? a) An abstract class cannot have any methods b) An abstract method must be implemented in a subclass c) An abstract class can be instantiated directly d) An abstract method can have a body Answer: b) An abstract method must

Which of the following statements about the ‘abstract’ keyword in Java is true? Read More »

Which of the following is true about the ‘volatile’ keyword in Java?

Java MCQ: Which of the following is true about the ‘volatile’ keyword in Java? a) It ensures that a variable’s value is read from main memory, not from a thread’s local cache b) It prevents multiple threads from accessing a variable simultaneously c) It guarantees that a variable cannot be modified d) It is used

Which of the following is true about the ‘volatile’ keyword in Java? Read More »

Which of the following is not a feature of the Java programming language?

Java MCQ: Which of the following is not a feature of the Java programming language? a) Platform-independent b) Object-oriented c) Pointer-based d) Multithreaded Answer: c) Pointer-based Explanation: Java is a platform-independent, object-oriented, and multithreaded programming language, but it does not support pointers. Pointers are used in languages like C and C++ to directly access memory

Which of the following is not a feature of the Java programming language? Read More »

Which of the following is true about encapsulation in Java?

Java MCQ: Which of the following is true about encapsulation in Java? a) Encapsulation allows internal implementation to be hidden from the user b) Encapsulation is achieved using access modifiers c) Encapsulation makes code more flexible and maintainable d) All of the above Answer: d) All of the above Explanation: Encapsulation in Java is the

Which of the following is true about encapsulation in Java? Read More »

Which of the following statements about Java constructors is true?

Java MCQ: Which of the following statements about Java constructors is true? a) Constructors must have a return type b) Constructors can be abstract c) Constructors cannot be synchronized d) Constructors do not have a return type Answer: d) Constructors do not have a return type Explanation: Constructors in Java are special methods used to

Which of the following statements about Java constructors is true? Read More »

Which of the following is not a feature of Java?

Java MCQ: Which of the following is not a feature of Java? a) Dynamic b) Platform-independent c) Machine-dependent d) Multithreaded Answer: c) Machine-dependent Explanation: Java is designed to be platform-independent, meaning that Java programs can run on any device or operating system that has the Java Virtual Machine (JVM) installed. This “write once, run anywhere”

Which of the following is not a feature of Java? Read More »

Which of the following is not a valid access modifier in Java?

Java MCQ: Which of the following is not a valid access modifier in Java? a) private b) protected c) public d) internal Answer: d) internal Explanation: In Java, the valid access modifiers are private, protected, and public. These modifiers control the visibility of classes, methods, and variables. private makes a member accessible only within the

Which of the following is not a valid access modifier in Java? Read More »

Which of the following best describes method overloading in Java?

Java MCQ: Which of the following best describes method overloading in Java? a) Method overloading occurs when two methods in the same class have the same name but different parameter lists b) Method overloading is the process of overriding a method in a subclass c) Method overloading refers to the runtime resolution of method calls

Which of the following best describes method overloading in Java? Read More »

Which of the following is a characteristic of the ‘transient’ keyword in Java?

Java MCQ: Which of the following is a characteristic of the ‘transient’ keyword in Java? a) It prevents serialization of the variable b) It ensures that the variable is serialized c) It allows the variable to be accessed from any thread d) It makes the variable immutable Answer: a) It prevents serialization of the variable

Which of the following is a characteristic of the ‘transient’ keyword in Java? Read More »

Which of the following is true about the ‘static’ keyword in Java?

Java MCQ: Which of the following is true about the ‘static’ keyword in Java? a) Static methods belong to the class, not instances b) Static methods can access instance variables directly c) Static methods can be abstract d) Static methods can override instance methods Answer: a) Static methods belong to the class, not instances Explanation:

Which of the following is true about the ‘static’ keyword in Java? Read More »

Which of the following is true about inheritance in Java?

Java MCQ: Which of the following is true about inheritance in Java? a) Inheritance allows a class to inherit fields and methods from another class b) Java supports multiple inheritance through classes c) Inheritance is implemented using the ‘implements’ keyword d) Inheritance prevents method overriding Answer: a) Inheritance allows a class to inherit fields and

Which of the following is true about inheritance in Java? Read More »

Scroll to Top