Tuesday, January 7, 2020

Java Interview Q_A

1) Define abstraction and what is the difference between abstract class and interface?
2) Can abstract class have constructor method?
3) How will we invoke abstract class constructor?
4) How will we invoke abstract class parameterized constructor?
5) Does java.util.List.isEmpty() check if the list itself is null? - No
6) How to get first item from a java.util.Set? - collection.stream().findFirst()
7) Why does findFirst() throw a NullPointerException if the first element it finds is null?
8)  Can we break out of a forEach loop when going through an Array? - No
There is no way to stop or break a forEach() loop other than by throwing an exception. If you need such behaviour, the . forEach() method is the wrong tool, use a plain loop instead.
9) 

No comments:

Post a Comment

Web Development

Design Phase:- Below all these represent different stages of the UX/UI design flow:- Wireframes represent a very basic & visual repr...