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

Search Java Interview Questions


 2137 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



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

 Q1. Can constructors be synchronized in Java ?Core Java
Anonymous
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     Tieto      expert        rare


 Q2. Can we use null as a key for a map collection ?Core Java
Anonymous
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     BlackBerry


 Q3. Can we override static methods ? Why ?Core Java
Anonymous
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


 Q4. Can we reduce the visibility of the inherited or overridden method ?Core Java
Anonymous
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


 Q5. Can we declare interface methods as private ?
Anonymous
Ans. No.

 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


 Q6. Can we have multiple servlets in a web application and How can we do that ?Java EE
Anonymous
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


 Q7. Can we instantiate the object of derived class if parent constructor is protected ?Core Java
Anonymous
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


 Q8. Can we call constructor explicitly ?
Admin
info@buggybread.com
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


 Q9. Is it possible to compile and run a Java program without writing main( ) method?
Admin
info@buggybread.com
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



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



  Q10. Can we overload main method in Java ?Core Java
Admin
info@buggybread.com
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     The Advisory Board Company  Thomson Reuters  ePace Technologies  PC Technology  PEOL  MilleniumSoft      intermediate        frequent


 Q11. Can we use static method definitions in Interfaces ?Core Java
Admin
info@buggybread.com
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     HCL Technologies


 Q12. Can we reduce the visibility of the overridden method ?Core Java
Anonymous
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


 Q13. Does Java provides default copy constructor ?Core Java
Anonymous
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


 Q14. Is runnable a Marker interface ?Core Java
Anonymous
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


 Q15. Will Compiler creates a default no argument constructor if we specify only multi argument constructor ?
Anonymous
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


 Q16. Can we overload constructors ?
Anonymous
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


 Q17. Do we need to import java.lang package ?Core Java
Anonymous
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


 Q18. Can finally block be used without catch ?Core Java
Anonymous
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


 Q19. Can we declare an abstract method private ?
Anonymous
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



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q20. Is JVM a overhead ?
Admin
info@buggybread.com
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


 Q21. Is it legal to initialize List like this ?


LinkedList l=new LinkedList();
Admin
info@buggybread.com
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


 Q22. Can finally block throw an exception ?Core Java
Admin
info@buggybread.com
Ans. Yes.

 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


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

java.util.Calendar c = new java.util.Calendar();
Core Java
Admin
info@buggybread.com
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


 Q24. Can value be null in TreeMap ?Core Java
Admin
info@buggybread.com
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


 Q25. Is It Good to use Reflection in an application ? Why ?Core Java
Admin
info@buggybread.com
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     Overstock.com      intermediate


Rarely asked as default methods have been introduced with Java 8.
 Q26. Can we have a default method without a Body ?Core Java
Admin
info@buggybread.com
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


 Q27. Does java allow implementation of multiple interfaces having Default methods with Same name and Signature ?Core Java
Admin
info@buggybread.com
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     cognizant (CTS)      intermediate


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
Admin
info@buggybread.com
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
Admin
info@buggybread.com
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   yes-no     Sapient      intermediate



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q30. Should we create system software ( e.g Operating system ) in Java ?Core Java
Admin
info@buggybread.com
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


 Q31. Will this Code compile ?

abstract public class BuggyBread1{
abstract public void test(){};
}
Core Java
Admin
info@buggybread.com
Ans. No. This will give a compilation error saying "Abstract methods do not specify a body".

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

   Like      Discuss      Correct / Improve     java   abstract classes   abstract methods   java compilation error   java coding   java code   coding   yes-no


 Q32. Can we use Fisheye and Crucible independently ?
Admin
info@buggybread.com
Ans. Yes

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

   Like      Discuss      Correct / Improve     java   fisheye   crucible   code review   tools   yes-no


 Q33. Does Kafka uses ZooKeeper ?
admin
info@buggybread.com
Ans. Yes

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

   Like      Discuss      Correct / Improve     kafka   bigdata   yes-no   yes no




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

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:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: