Core Java - Interview Questions and Answers for 'Yes-no' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Core Java - Interview Questions and Answers for 'Yes-no' - 33 question(s) found - Order By Newest

next 30
 Q1. Can constructors be synchronized in Java ?Core Java
Ans. No. Java doesn't allow multi thread access to object constructors so synchronization is not even needed.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     synchronization   synchronize   constructor   java   multithreading   yes-no   advanced     Asked in 1 Companies      expert        rare


 Q2. Can we use null as a key for a map collection ?Core Java
Ans. Yes , for HashMap. HashMap implements Map interface. HashMap allows one null key and any number of null values.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   collections   hashmap   map   hashtable   yes-no     Asked in 1 Companies


 Q3. Can we declare interface methods as private ?
Ans. With Java 9 we can declare interface methods as private

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   interfaces   yes-no   private


  Q4. Can we overload main method in Java ?Core Java
Ans. Yes, but the overloaded main methods without single String[] argument doesn't get any special status by the JVM. They are just another methods that needs to be called explicitly.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   main method   overloading   yes-no     Asked in 6 Companies      intermediate        frequent


 Q5. Can we override static methods ? Why ?Core Java
Ans. No.

Static methods belong to the class and not the objects. They belong to the class and hence doesn't fit properly for the polymorphic behavior.

A static method is not associated with any instance of a class so the concept of overriding for runtime polymorphism using static methods is not applicable.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   static   static methods   java keywords   yes-no      intermediate        frequent


 Q6. Can we reduce the visibility of the inherited or overridden method ?Core Java
Ans. No.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   access specifier   overriding   overridding   inheritence   yes-no


 Q7. Can we have multiple servlets in a web application and How can we do that ?Java EE
Ans. Yes by making entries in web.xml

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     j2ee   servlets   servelets   web application   java   web.xml   yes-no   architecture


 Q8. Can we instantiate the object of derived class if parent constructor is protected ?Core Java
Ans. Yes, as protected constructor is accessible in sub class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   constructor   access specifier   protected   yes-no  private constructor


 Q9. Can we declare an abstract method private ?
Ans. No Abstract methods can only be declared protected or public.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   abstract   oops   access specifier   private   yes-no      intermediate        rare


 Q10. Can we call constructor explicitly ?
Ans. Yes.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   constructor   constructor chaining   oops   call constructor explicitly   yes-no

Try 1 Question(s) Test


 Q11. Is it possible to compile and run a Java program without writing main( ) method?
Ans. Yes, it is possible by using a static block in the Java program.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   main   static block   compile   yes-no


 Q12. Does java allow implementation of multiple interfaces having Default methods with Same name and Signature ?Core Java
Ans. No. Compilation error.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java8   default method   yes-no     Asked in 1 Companies      intermediate


 Q13. Can we use static method definitions in Interfaces ?Core Java
Ans. Yes, Effective Java 8.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java8   static interface methods   yes-no     Asked in 1 Companies


 Q14. Can we reduce the visibility of the overridden method ?Core Java
Ans. No

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     overriding   access specifier   oops   java   yes-no


 Q15. Does Java provides default copy constructor ?Core Java
Ans. No

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   constructor   copy constructor   yes-no


 Q16. Is runnable a Marker interface ?Core Java
Ans. No , it has run method declared.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   interfaces   marker interface   runnable   yes-no


 Q17. Will Compiler creates a default no argument constructor if we specify only multi argument constructor ?
Ans. No, Compiler will create default constructor only if we don't specify any constructor.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   constructor   default constructor   yes-no      expert        rare

Try 1 Question(s) Test


 Q18. Can we overload constructors ?
Ans. Yes.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   constructors   overloading   yes-no   basic interview question


 Q19. Do we need to import java.lang package ?Core Java
Ans. No, It is loaded by default by the JVM.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   jvm   java.lang.package   yes-no


 Q20. Can finally block be used without catch ?Core Java
Ans. Yes but should follow "try" block then.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   exceptions   exception handling   try   catch   finally   yes-no

Try 1 Question(s) Test


 Q21. Is JVM a overhead ?
Ans. Yes and No. JVM is an extra layer that translates Byte Code into Machine Code. So Comparing to languages like C, Java provides an additional layer of translating the Source Code.

C++ Compiler - Source Code --> Machine Code
Java Compiler - Source Code --> Byte Code , JVM - Byte Code --> Machine Code

Though it looks like an overhead but this additional translation allows Java to run Apps on all platforms as JVM provides the translation to the Machine code as per the underlying Operating System.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   jvm   interpreter   platform independent   yes-no   advanced   architecture


 Q22. Is it legal to initialize List like this ?


LinkedList l=new LinkedList();
Ans. No, Generic parameters cannot be primitives.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   collections   list   linkedlist   generics   yes-no


 Q23. Can finally block throw an exception ?Core Java
Ans. Yes. Methods invoked from within a finally block can throw an exception. Failure to catch and handle such exceptions results in the abrupt termination of the entire try block.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   exceptions   exception handling   finally   yes-no


 Q24. Will this code Work ? If not , Why ?

java.util.Calendar c = new java.util.Calendar();
Core Java
Ans. No. It gives the error "Cannot Instantiate the type Calendar". Calendar is an abstract class and hence Calendar object should be instantiated using Calendar.getInstance().

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   date   calendar   abstract class   yes-no


 Q25. Can value be null in TreeMap ?Core Java
Ans. Yes.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   collections   treemap   yes-no


 Q26. Is It Good to use Reflection in an application ? Why ?Core Java
Ans. no, It's like challenging the design of application.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   reflection api   yes-no   architecture     Asked in 1 Companies      intermediate


Rarely asked as default methods have been introduced with Java 8.
 Q27. Can we have a default method without a Body ?Core Java
Ans. No. Compiler will give error.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java8   default method   yes-no        rare


Rarely asked as default methods have been introduced with Java 8.
 Q28. Can we have a default method definition in the interface without specifying the keyword "default" ? Core Java
Ans. No. Compiler complains that its an abstract method and hence shouldn't have the body.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java8   default methods   default keyword   yes-no


 Q29. Can we extend an Enum ?Core Java
Ans. No. Enums are final by design.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   enums   inheritance  object oriented programming (oops)  oops concepts   yes-no     Asked in 1 Companies      intermediate


 Q30. Should we create system software ( e.g Operating system ) in Java ?Core Java
Ans. No, Java runs on a virtual machine called JVM and hence doesn't embed well with the underlying hardware. Though we can create a platform independent system software but that would be really slow and that's what we would never need.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   system software java   jvm   yes-no   yes no   java operating system   architecture


next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: