πŸ“Š JAVA
Q. Which of the following is a method having same name as that of its class?
  • (A) finalize
  • (B) delete
  • (C) class
  • (D) constructor
πŸ’¬ Discuss
βœ… Correct Answer: (D) constructor
πŸ“Š JAVA
Q. Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?
  • (A) delete
  • (B) free
  • (C) new
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (D) None of the mentioned
πŸ“Š JAVA
Q. Which of these access specifiers must be used for main() method?
  • (A) private
  • (B) public
  • (C) protected
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) public
πŸ“Š JAVA
Q. Which of these is used to access member of class before object of that class is created?
  • (A) public
  • (B) private
  • (C) static
  • (D) protected
πŸ’¬ Discuss
βœ… Correct Answer: (C) static
πŸ“Š JAVA
Q. The keyword used to create an object
  • (A) class
  • (B) this
  • (C) new
  • (D) malloc
πŸ’¬ Discuss
βœ… Correct Answer: (C) new

Explanation: new keyword is used to create object of class. For example:

Class Student {
//Some code

}


Student stu1 = new Student();

This will create an object of class Student.

πŸ“Š JAVA
Q. The keyword used to refer the current object
  • (A) class
  • (B) this
  • (C) new
  • (D) malloc
πŸ’¬ Discuss
βœ… Correct Answer: (B) this
πŸ“Š JAVA
Q. The method which is automatically invoked during garbage collection.
  • (A) destructor
  • (B) terminate()
  • (C) finalize()
  • (D) destroy()
πŸ’¬ Discuss
βœ… Correct Answer: (C) finalize()
πŸ“Š JAVA
Q. Which class cannot have a subclass in java
  • (A) abstract class
  • (B) parent class
  • (C) final class
  • (D) None of above
πŸ’¬ Discuss
βœ… Correct Answer: (C) final class
πŸ“Š JAVA
Q. Which is the keyword used to inherit a class to another?
  • (A) Inherits
  • (B) extends
  • (C) implements
  • (D) import
πŸ’¬ Discuss
βœ… Correct Answer: (B) extends
πŸ“Š JAVA
Q. The use of final keyword with method definition
  • (A) Supports method overriding
  • (B) implements dynamic method dispatch
  • (C) Prevents method overriding
  • (D) none of these
πŸ’¬ Discuss
βœ… Correct Answer: (C) Prevents method overriding