Latest Core Java Interview Questions

1   - Store Employee Type Object To HashSet based on id.
Ans - HashSet don't accept duplicate Values it means if id is douplicate we will not store employee object to our HashSet.
      For this we need to override equals and hashCode method based on id.
      Check Here for detail.

2   - StackOverflow vs OutOfMemoryError in java.
Ans : StackOverFlow :  Stack contains method call and static variables, if any method called running in  infinite loop or stack don't have more memory to handle it, then will get StackOverFlow.

OutOfMemoryError : Heap provide memory to objects for execution and when heap memory got full and no free space is available for other objects to run then OutOfMemoryError occurred.
       More Details click here 

3   - Exception handling, type of exception ,Custome Exception.

4   - Memory Managment in jvm.
      Resources :  DZone
                            Oracle
                            Betsol

5   - HashMap, HashSet intenal working.

6   - Fail fast / fail safe.

7   - Concurrent hashmap vs Synchronised hashMap.

8   - For loop vs switch which is faster.

9   - Create own queue using Array.

10 - Count word count or character count in a string.
Ans : Click Here

11 - Traverse tree in inOrder, preOrder, postOrder, spiral.
Ans : Click Here

12 - Clone linked list with Arbitary pointer to a new linked list.
Ans : Click Here

13 - Count number of occurrence in an array.
Ans : Click Here

14 - Which interface internally used by Stream().filter() ?.
Ans : Predicate interface ( Stream<T> filter(Predicate<? super T> predicate); ).

15 : In which class/interface Stream() is present ?
Ans :  Collection interface ( default Stream<E> stream() {
        return StreamSupport.stream(spliterator(), false);
    })




Post a Comment

Previous Post Next Post