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) {
        List nums = 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

Popular posts from this blog

26th September - Day 15 of writing Diary

Day 2 of writing Diary

6th October Day 25 of writing Diary