Java 8 New Features Interview Questions And Answers( Live Demo) Part 2 | Code Decode

In this video of Code Decode we have covered Java 8 New Features Interview Questions And Answers( Live Demo) Part 2 Udemy Course of Code Decode on Microser...

Java 8 New Features Interview Questions And Answers( Live Demo) Part 2 | Code Decode
Code Decode
238.5K views • Jan 19, 2021
Java 8 New Features Interview Questions And Answers( Live Demo) Part 2 | Code Decode

About this video

In this video of Code Decode we have covered Java 8 New Features Interview Questions And Answers( Live Demo) Part 2

Udemy Course of Code Decode on Microservice k8s AWS CICD link:
https://openinapp.co/udemycourse

Course Description Video :
https://yt.openinapp.co/dmjvd

Java 8 Interview Questions Complete Playlist :
https://youtube.com/playlist?list=PLyHJZXNdCXsdeusn4OM33415DCMQ6sUKy

This video covers java 8 new features. Interview Questions Based on tricky concepts of those new java 8 features and Java 8 Interview Questions and Answers.

Few questions we covered like:

What are defaults methods?
Default method is a way for adding new methods to the interface without affecting the implementing classes. Hence with this new feature Java people defended many compile time errors that may arise due to unimplemented methods of interface.

The use of these default methods is “Backward Compatibility” which means if JDK modifies any Interface (without default method) then the classes which implement this Interface will break.

On the other hand, if you add the default method in an Interface then you will be able to provide the default implementation. This won’t affect the implementing classes.

Q) Is it necessary to override default methods of interface in java 8?
Default methods have dummy implementations.
Implementing classes if ok with dummy implementation then use dummy implementation of default methods
If not satisfied then they can override and provide their own implementation.

Q) Is the default keyword one of the access modifiers?
Default is not the access modifier like public or protected or public
Q) How to override default methods?

You can override the default method by keeping the same method signature (name + arguments)

Removing default keywords because in class default keyword is used in switch case to denote default case if no previous cases matched. So you cant use the Default keyword in Class

Adding Public as access modifier as in java 8, by default all methods are public so in child, u cant reduce the visibility of overridden default method.
Giving our own implementation.


Q) Why Static methods were introduced in JAVA8
Only reason for introducing static methods in the interface is that you can call those methods with just interface name. No Need to create a class and then its object.

Since Interface can never contain :
Constructors,
Static blocks,
Nothings are costly in terms of memory and performance.

Hence we don’t need to create an object and hence if you have everything static, then for interface rather than class

( You have this flexibility only after java 8, before that you need to create a class)


Q) Are Static Methods available to implementing classes by default?
Static methods are not available for implementing classes.

They are not default methods. They are static.

Hence you can call these methods using the Interface name explicitly from the implementing classes as implementing classes won't have access to these methods directly. (This is the disadvantage of static methods of interface that its not available to implementing classes.)

Java 8 New Features Predicate, Function, Consumer, Supplier, Streams, Parallel Stream's and many more topics.

-------------------------------------------------------------------------------------------------------------------------------------

Code Decode Playlists

Most Asked Core Java Interview Questions and Answers : https://youtube.com/playlist?list=PLyHJZXNdCXscoyL5XEZoHHZ86_6h3GWE1

Advance Java Interview Questions and Answers : https://youtube.com/playlist?list=PLyHJZXNdCXsexOO1VQ4vs-BM2-8CKrixd

Java 8 Interview Questions and Answers : https://youtube.com/playlist?list=PLyHJZXNdCXsdeusn4OM33415DCMQ6sUKy

Hibernate Interview Questions and Answers : https://youtube.com/playlist?list=PLyHJZXNdCXsdC-p2186C6NO4FpadnCC_q

Spring Boot Interview Questions and Answers : https://youtube.com/playlist?list=PLyHJZXNdCXsexOO1VQ4vs-BM2-8CKrixd

Angular Playlist : https://www.youtube.com/watch?v=CAl7RQSdq2Q&list=PLyHJZXNdCXsfxRtDwtGkDD_lLfTWc1g0i

GIT : https://youtube.com/playlist?list=PLyHJZXNdCXscpl6pxOnL2lRWJlzvzjyZE

-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode

Subscriber Code Decode : https://www.youtube.com/c/CodeDecode?sub_confirmation=1

Linkedin : https://www.linkedin.com/in/codedecodeyoutube/

Instagram : https://www.instagram.com/codedecode25/

--------------------------------------------------------------------------------------------------------------------------------------
#JAVA8 #JAVA8InterviewQuestions #JAVAInterviewQuestions #codedecode

Video Information

Views

238.5K

Likes

2.9K

Duration

22:41

Published

Jan 19, 2021

User Reviews

4.5
(47)
Rate:

Related Trending Topics

LIVE TRENDS

Related trending topics. Click any trend to explore more videos.