MCQ on Java keywords


Q) In Java static variable is used to
  1. Refer common properties to all objects.
  2. get persistent value between different method call
  3. It gets memory only once in a class area at the time of class loading.
  4. All are correct
View Answer
Answer: D

 

Q) False statement about static method in java
  1. Belongs to class not object of the class
  2. Can be called without any object creation of a class
  3. Can access non static and static variables both.
  4. All are correct.
View Answer
Answer: C
Static method in java can access only static variables or static method.

Q) In java, “this” keyword is used to
  1. Pass as an argument to a method.
  2. Refer current class object.
  3. Return current class object.
  4. All are correct.
View Answer
Answer: D

Q) Which keyword is used to refer current object of a class in Java?
  1. this
  2. new
  3. current
  4. None
View Answer
Answer: A



Leave a Comment