Java Interview Concepts
- A Functional interface should have only 1 abstract method.
- All Non static methods of an interface should be abstract.
- When we write code we have to write too many null checks else we get Null point exception inorder to avoid it Optional class came in Java 8. Two methods 1. static <T> Optional<T> ofNullable(T value) 2. orElse(T other)
- Returns the value if present, otherwise returns other.
- Returns an Optional describing the specified value, if non-null, otherwise returns an empty Optional
- Enum Constructor must be private.
Comments
Post a Comment