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. b,c and d i.e final , public and static | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  java   interface   interface variables | |||||||||||
| |||||||||||
Ans. Clonable | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interfaces   java   CertStoreParameters   include | |||||||||||
| |||||||||||
Ans. As Class B has been declared abstract , we can either implement any of these methods and just declare rest of them abstract. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interfaces  abstract classes  code  coding | |||||||||||
Try 2 Question(s) Test | |||||||||||
Frequently asked. | |||||||||||
| |||||||||||
Ans. It should either implement all interface methods or declare unimplemented methods as abstract. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interfaces Asked in 1 Companies Basic   frequent | |||||||||||
Try 1 Question(s) Test | |||||||||||
| |||||||||||
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, a Class is supposed to define all abstract methods declared in the interface. With Java 8 , Interfaces can have default methods which need not be implemented by the implementing class. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interfaces | |||||||||||
| |||||||||||
Ans. Implementing Comparable interface means that the elements of the class are comparable i.e the class provides the implementation of compareTo method that would help comparing the elements. This is usually required if we are planning to sort elements of a collection, If compareTo method is not defined , the sorting class / method could never understand a way to compare its elements in order to sort them. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  comparable interface | |||||||||||
Try 1 Question(s) Test | |||||||||||
| |||||||||||
Ans. Here is the list of classes that implements Collections Interface - http://www.buggybread.com/2015/02/java-collections-classes-that-implement.html Having Collection interface to extend Cloneable interface would mean necessarily implement clone method by all implementing classes. As not all collection classes allow duplicate elements, it makes no sense to clone elements for them. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  cloneable  collections  collection interface  cloning | |||||||||||
| |||||||||||
Ans. java.util.Collection | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  collection interface  collections | |||||||||||
| |||||||||||
Ans. Yes, we can define an inner class within interface.Inside the interface, the inner class is implicitly public static. So the following is legit in Java public interface BuggyBreadInterface { void doSomething(); public class BuggyBreadClass implements BuggyBreadInterface{ void doSomething(){ System.out.println("Do something"); } } } | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  inner classes  inner class in interface  nested classes | |||||||||||
| |||||||||||
Ans. Interface that is declared inside the interface or class, is known as nested interface. It is static by default. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interface  nested interface intermediate | |||||||||||
Try 1 Question(s) Test | |||||||||||
| |||||||||||
Ans. It will print 4 because member elements of an interface are implicitly static and hence the concept of overriding doesn't work. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interfaces  coding  code  extending interfaces  diamond interfaces Asked in 1 Companies intermediate | |||||||||||
| |||||||||||
Ans. 10 | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interfaces  coding  code intermediate | |||||||||||
| |||||||||||
Ans. Executor - Simple Interface that supports launching new tasks. ExecutorService - Subinterface of Executor, which adds features that help manage the lifecycle, both of the individual tasks and of the Executor itself. ScheduledExecutorService - Subinterface of ExecutorService, supports future and-or periodic execution of tasks. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Executor Interfaces Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. Session,SessionFactory,Configuration,Transaction,query and Criteria | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  core interfaces of Hibernate Asked in 1 Companies   frequent | |||||||||||
Try 1 Question(s) Test | |||||||||||
| |||||||||||
This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  core interfaces of Spring mvc | |||||||||||
| |||||||||||
Ans. Yes , we can have an interface that is part of a class. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  inner classes   inner interface  nested classes | |||||||||||
| |||||||||||
Ans. No. No interface provides any implementation and hence the declaration isn't viable. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interface basic | |||||||||||
| |||||||||||
Ans. Abstract Classes provide default implementations of methods that are inherited by the classes that extend them, which was not the case for Interfaces. This changed in Java 8, where default implementations are provided for methods. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  abstract classes  interfaces  default method Asked in 1 Companies expert | |||||||||||
| |||||||||||
This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Threads  Thread class  runnable interface | |||||||||||
| |||||||||||
Ans. The interface is a mechanism to achieve abstraction. Interfaces can have abstract methods and variables. It cannot have a method body. | |||||||||||
Sample Code for interface | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interface Asked in 1 Companies basic   frequent | |||||||||||
| |||||||||||
Ans. Create interface with the only one non-overriding abstract method and annotate it with @FunctionalInterface | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  functional interface  java 8 Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. Yes, With Java 8 we can use Interfaces as collection of utility methods through the use of default methods. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  java 8  interfaces  utility class   utility classes | |||||||||||
| |||||||||||
This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interface   constructor | |||||||||||
| |||||||||||
Ans. Yes | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  .class file  java byte code  interfaces | |||||||||||
| |||||||||||
Ans. Java 1.8 or Java 8 | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  default methods   interface default methods   java 8  java 8 features | |||||||||||
| |||||||||||
This question was recently asked at 'Oracle financial services'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interface vs abstraction  interfacing vs abstraction  relation between interface and abstraction  How interface provide abstraction Asked in 1 Companies | |||||||||||
| |||||||||||
This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interfaces in typescript | |||||||||||
| |||||||||||
| |||||||||||