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. |
|
| ||||
Interview Questions and Answers - Order By Newest | ||||
| ||||
Ans. Buggy | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   code   coding   stringbuffer   string   method calling   pass by reference | ||||
| ||||
Ans. Compile Time Error: Unhandled exception type Exception | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   code   coding   overridding   late binding   exception handling   abstract class   abstract methods | ||||
| ||||
Ans. Base Class Definition. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   default methods | ||||
Rarely asked as default methods have been introduced with Java 8. | ||||
| ||||
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. | ||||
| ||||
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 | ||||
Ans. No. Compiler gives error saying "Duplicate Default Methods" | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   default methods | ||||
Ans. Even then the Compiler will give error saying that there is a conflict. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   default methods | ||||
Ans. There won't be any error and upon execution the overriding class method will be executed. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   default methods | ||||
| ||||
Ans. There won't be any problem as the Base class method will have precedence over the Interface Default methods. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   default methods | ||||
Ans. Class method definition is overriding both the definitions and hence will be picked. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   default methods | ||||
Ans. Base Class Definition will have precedence over the Interface Default method definition. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   default methods | ||||
| ||||
Ans. No, only using Interface Name. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   static interface methods | ||||
| ||||
Ans. Yes , we can do that as static methods are not accessible using references and hence cannot lead to conflict. We cannot do inverse as Default methods cannot be overridden with the static methods in derived interface. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   default methods   static interface methods | ||||
Not frequently asked as it was introduced with Java 8. | ||||
| ||||
Ans. This is an informative annotation that specify that the interface is a functional interface. A Function Interface has only one abstract method and many default methods. Compiler generates an error if the interface specified with the annotation doesn't abide by the specifications for functional interface. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java8   java 8   functional interface   default methods | ||||
| ||||
Ans. No. It will give the compilation error saying "The abstract method test in type BuggyBread1 can only be defined by an abstract class". We need to declare the class abstract for it to have any abstract method. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   abstract class   abstract methods   java compilation error | ||||
| ||||
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 | ||||
| ||||
Ans. We are using Agile methodology. I attend daily stand up where the development leads takes the status of assigned stories, achievements, any bottlenecks or challenges. We follow iteration of 2 weeks. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  sdlc   agile methodology   software system analyst   software developer interview   development lead   project lead interview Asked in 14 Companies   frequent | ||||
| ||||
Ans. Static methods are resolved during compile time and hence they cannot participate in runtime polymorphism. Instance methods are resolved during runtime. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   static methods   methods   runtime polymorphism intermediate | ||||
Ans. By initiating the flow in any of static block | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  main method   java | ||||
| ||||
Ans. TDD is a development process that involves short iterations: first an automated test case is written. Then, the code is written to pass that test, and finally one refactors the new code to acceptable standards. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  elsevier   test driven design ( TDD )   software development methodologies Asked in 3 Companies   frequent | ||||
| ||||
Ans. MethodHandle is a modern, more flexible, more typesafe way of doing reflection. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  MethodHandle  Reflection | ||||
| ||||
Ans. All methods defined in a class that are not marked static are actually instance methods. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  methods  functions | ||||
| ||||
Ans. Yes, But the method should have some return type as otherwise it will be treated as a constructor. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  constructor  methods  method names | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. No. Static methods cannot be overridden and hence make no sense to be declared abstract. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  main method   abstract | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. Request Body in case of Get Request has no meaning and hence it's not parsed when the request is received. Alternatively Request Parameters are passed as either Path Params or Query Params. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  rest  web services  http  http methods  get request | ||||
| ||||
Ans. No, Main method is the entry point into an application. An application usually contain multiple classes to perform a function. Lets take an example of a House, House usually have only one external Door and you may have internal doors to move around within a house. Internal Doors are methods of classes whereas External Door is a special method called main method. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  main method | ||||
| ||||
Ans. Default methods results in multiple inheritance of behavior and not of state. In case we try to implement multiple interfaces with default method having same name and signature, and don't override it in implementation class, it will throw an error. For example - interface MyInterface { public void default myMethod(){ } } interface MyInterface2 { public void default myMethod(){ } } class MyClass implements MyInterface,MyInterface2 { } This code will compilation error "Duplicate Default Method" if we specify the definition of myMethod() in myClass, compiler won't complain and there is no conflict and MyClass can use overridden definition. But if we don't override myMethod() in MyClass, Java would be in conflict as to what definition should be carried to MyClass and hence throws compilation error. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  default methods  java 8  multiple inheritance  object oriented programming (oops)  oops concepts  diamond problem   interfaces | ||||
| ||||
Ans. Yes, compiler won't complain but at runtime it will give an error saying "Error: Main method not found in class". Even though we can use this method as any other private method, it cannot be invocate by executing the class. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  main method   main method visibility basic | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. No, If both Parent and Derived are outer classes. public class Vehicle { private static String manufacturingDate = "2016"; } public class Car extends Vehicle{ public static void main(String args[]){ System.out.println(manufacturingDate); // error - The field Vehicle.manufacturingDate is not visible } } Yes, If derived is the inner class of Parent. public class Vehicle { private static String manufacturingDate = "2016"; static public class Car extends Vehicle{ public static void main(String args[]){ System.out.println(manufacturingDate); // no problem } } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  private members   private methods   private variables   inheritance  object oriented programming (oops)  oops concepts   members visibility   inner classes  nexted classes basic   frequent | ||||
| ||||
Ans. static methods and static elements are shared by all objects of a class and hence could create problem. Static methods are not synchronized by default and hence could create problem when accessed through multiple threads. Static elements are shareable by class and hence state of one object could be altered by another object. Some limitations with Unit testing as not all mocking framework facilitate mocking them. Power mock allows but Mockito doesn't | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  static  static method  static variables | ||||