 Good morning guys. So today in this video, I'll be sharing you Java 8 interview questions that will be asked to you in all the interviews if you say you have worked on Java 8 and these are the theoretical questions that I am going to share you because the coding we have already started a different series on that so all the coding questions will be covered there and these are mandatory questions that all the Java developers should know if they say they are working on Java 8. So coming to the first question, what are the features that got introduced in Java 8? So you can list down all the features that got introduced in Java 8. When I answer, I specifically answer those features that I have worked like if someone asked me on what all features that got introduced in Java 8, I would say streams, default and static methods, lambda expressions, functional interfaces, optional class, and method references. And apart from this, there were few other enhancements as well on JDK or a hash map or you can say on daytime API, but as I haven't worked on that, I am not that much sure on what exact enhancements has happened over there. So this way I answer, it's up to you how you want to answer because if you are answering all the features that got introduced, definitely there are high chances that interviewer will ask you questions on that. And as you have not worked on it and there are few chances that you may not answer it properly. So this is my way of answering. So it's up to you how you answer. So next question is what advantages Java 8 brings? Like what actual advantages that Java 8 bring? So here are the few advantages that I personally feel that Java 8 brought in like the code is more concise and readable now, more reusable now, it is easily testable and maintainable, both highly concurrent and scalable. You know, we can write parallel code, we can perform database kind of operations, which is one of the interesting part of Java 8 applications now perform better as they are performing parallelly the performance increases and the code is more productive, we can select within less amount of time, we can do a lot of coding. So these are the few advantages that I feel Java 8 brought in. If you have any other advantages that you feel, you can please comment it out in the comment section so that it might be helpful for me as well for every other people who are watching this video. Next question, what enhancements have been done to JDK? So this is one important interview question for especially for experienced candidates. So now if you are aware of how what enhancements that has been happened that is good if you don't know what has happened. So now the Pungent got removed and it is replaced by Metaspace. So what advantage Metaspace is like what what issue we used to have with Pungent is it was a fixed size. Once the size used to extend used to get exception. But now coming to Metaspace it can grow dynamically. So that is the advantage that Metaspace provides now. So that is one of the biggest advantage we can see. Next question, how like our how HashMap works in Java 8? You can face this question or how our what enhancements has been done on Java 8? This can be the question. Both questions state the same thing. So if you I am assuming that you know how Java 8 works internally. So Java 8 internally uses buckets. So a hash code is calculated on the key and it would be placed in the bucket like index will be calculated and it will be placed in the bucket. Now the enhancement that has been done here is after a certain threshold like if all the key everything is getting resetted with the same bucket the same index after a certain threshold instead of link will list or HashMap now will use balanced tree. So this is the new enhancement that has happened. So instead of using linked list and traversing each and every object now it is using balanced tree. What how lambda expressions and functional interfaces are related? So as far as I know lambda expressions can be worked only upon abstract methods like one functional interface both will go in handy then because on the abstract single abstract method that is present on that only lambda expressions will work. If I am wrong you can comment it out because as far as I know that is the only thing that is where only lambda expressions can be worked. What is stream pipelining? So stream pipelining is nothing but we are what you can say we are joining multiple intermediate operations. I hope you are aware of what are intermediate operations so intermediate operations are nothing but it won't give us a final result instead of if it is working on a stream it will again return a stream so multiple streams can be multiple intermediate operations can be performed so that is called stream pipelining and at the end we need a terminal operator. I hope everyone is aware that what are the terminal operations or what are intermediate operations so intermediate operations are lazy and we need a terminal operation at the end to invoke intermediate operation. What are functional interfaces? So functional interfaces are nothing but those interfaces which are having only one abstract method and they can have multiple default and static methods or it can work at the object class methods as well. So it was already present before Java 8 as well. We had comparator, comparable, runnable, callable these are the interfaces which can be called functional interfaces and when they say this there can be a question like can you create your own custom can you create your own functional interface so yes we can create using a thread function interface we can create our own functional interface and if at all we are annotating the interface with the thread function interface and if we are defining two like multiple abstract methods then the compile time itself we will get the exception so this would be there would be one more question on this as well so what will happen if at all I am using the thread function interface and I am defining multiple abstract methods instead that interface so a compile time issue will come there. What is method reference in Java 8? So method reference is nothing but a compact way of lambda expression so you can see the syntax like class name and method name can be given so directly we can call that method without double braces or we can call this. What is optional? Why and how can you use it? Basically what is optional class and what is advantage of optional class can be asked so optional class is nothing but it's a new class that code in Java 8 and it is basically used to avoid multiple null checks and to avoid null pointer exception I have seen all there is an already video on optional class in the queue so I am not creating I am not going in deep on this so this is one of the important question like what is optional class again? What are default methods needed in the interface? Why are default methods needed in the interface? So default methods let you add new functionality to your libraries like if at all there are hundred classes sorry hundred classes that are implementing an interface and if you want to add a new functionality you need to go and change those all hundred classes now instead of that we can directly add a default method inside an interface and we can we can achieve our requirement there. What's the difference between find first and find any? So find first and find any are both terminal operations so find first will return the first element meeting the criteria while find any returns any element meeting the standard feature that is very useful when working in with parallel stream. So these were the top questions you can say that top theoretical questions you can say that you can encounter in at least five questions out of this 10 to 12 questions you will encounter in every interview so that's it of the video if you haven't subscribed us you can subscribe you can if you like the video you can like press the like button if you want to share you share or down the other technical platform so that others might know about these questions and you can provide the feedback in the comment section as well. So who are we and what we do we are basically a bunch of software engineers who attend videos and and create our videos based on those interviews like interview experiences we are sharing through these videos and if you see the number of companies that the company needs that are getting printed on the screen so up to now we have shared these many company interviews already and there are a few others that are in the queue you can visit our channel and take advantage of by watching all these videos this will definitely help you because we receive a lot of mail saying like thank you mail saying that our channel is helping them in getting their jobs and we feel really happy because the earlier we thought at least 10 people gets like helpful or that is enough for us but now let me get lot more than like in hundreds we get them in we are sorry that we sometimes don't get a chance to reply back to all but if you want to share your interview experiences or if you have any queries you can reach us at the email ID that is there in the description as the and if you are want to contribute financially or you can click on the Amazon Affiliation link that is there in the description and you can buy if at all you are buying anything you can make use of this link and buy so that we may get some commission out of the amount that you spend there that's it for this video I hope this video helped you and thanks for watching