Coforge Interview Questions 2+ Years Experience
These questions were asked to me in a Interview for Java Developer by Coforge.
Struts 1 flow
struts 2 flow
functional interfaces
Functional Interfaces are interfaces which have only one abstract method. The interface is annotated with the annotation @FunctionalInterface.
are functional interfaces method special.
No.
lambda Expressions
max in lambda expressions
import java.util.Arrays; import java.util.List; import java.util.Optional; public class Main { public static void main(String[] args) { Listnums = Arrays.asList(12, 15, 0, 8, 7, 9, -6); System.out.println("Original values of the said array: " + nums); Optional max = nums.stream().max((x, y) ->x.compareTo(y)); System.out.println("Maximum value: " + max.orElse(null)); } } Annotations
assert()
assert() is used to verify a statement if it is true the flow is not disturbed if it is false
code throws assertionException.
testing using junit.
Comments
Post a Comment