Java - Interview Questions and Answers - Yes / No

Q1. Can we reduce the visibility of the overridden method ?

Ans. No

Q2. Can static method access instance variables ?

Ans. Yes. Though Static methods cannot access the instance variables directly, They can access them using instance handler.  

Q3. Does java allow overriding static methods ?

Ans. No. 

Q4. Can we serialize static variables ?

Ans. No. 

Q5. Does Java provides default copy constructor ?

Ans. No

Q6. Can constructors be synchronized in Java ?

Ans. No. 

Q7. can we create a null as a key for a map collection ?

Ans. Yes , for Hashtable.

Q8.  Can a lock be acquired on a class ?

Ans. Yes.

Q9.  Does garbage collection guarantee that a program will not run out of memory?

Ans. No.

Q10. Can I import same package/class twice? Will the JVM load the package twice at runtime?

Ans. Yes.

Q11.  Can we override static methods ? 

Ans. No. 

Q12.  Can we reduce the visibility of the inherited or overridden method ?

Ans. No.

Q13. Is runnable a Marker interface ?

Ans. No , it has run method declared.

Q14. Can we declare interface methods as private ?

Ans. No. 

Q15. Can we have multiple servlets in a web application and How can we do that ?

Ans. Yes by making entries in web.xml

Q16. Will Compiler creates a default no argument constructor if we specify only multi argument constructor ?

Ans. No.

Q17.  Can we overload constructors ?

Ans. Yes.

Q18. Can we use both "this" and "super" in a constructor ?

Ans. No.

Q19. Do we need to import java.lang.package ?

Ans. No, It is loaded by default by the JVM.

Q20. Can finally block be used without catch ?

Ans. Yes but should follow "try" block then.

Q21. Can we instantiate the object of derived class if parent constructor is protected ?

Ans. No

Q22. Can we declare an abstract method private ?

Ans. No.