I watched two hours of Navin's tutorials and I'm just trying to get a refresher on Java. I'm so upset that he wasn't around the years when i was learning Java. If you are starting to learn Java and come across Navin's playlist... it's like you've discovered a gold mine. Now i'm basically watching the rest of his tutorials because he's so clear and fun to watch.
But these videos are of older versions of Java. Many advancements took place in these days. If those advancements are too covered it'll be more helpful for the fresher's now
I dont mean to be off topic but does someone know of a tool to get back into an instagram account? I somehow forgot my login password. I would appreciate any tips you can offer me.
Been trying to learn Java through books, udemy courses, articles, and so far you're the best teacher I've found. Thanks,really. I've been stuck with some subjects like interfaces and your videos are clearing my doubts.
Thanks for this amazing tutorial Navin. You are saviour. Just would to add something. If there are two interfaces which define the same method (Ex: show()), then the class that implements these two interfaces does not always have to define the same method. Instead, it can use the "super" keyword like below which will also work. .super.show(); Nonetheless, thanks a lot once again. You are an amazing teacher.
Hi Prem, actually in this case you have to define the show() method in your class and then you can choose to call show() method in your definition by using InterfaceName.super.show();
I am watching this years later and still so relevant,its such a great quality content. I have not found anyone explaining java and making is to easy to understand and learn.Thank you for your hard work sir. Its really helpful
This is the most comprehensive video I have ever seen on default and static keywords. So many details listed out with such a simple and evenly paced delivery! You, sir, are simply amazing!
This is a gold quality information, take a bow Navin! I know this because I have been here for a while now and having worked with Java for 5ish years, I have rarely found such good quality videos. Pure Gold!
I was watching your videos past 3 days. i was really immpressed and appreciate your efforts to explaining the difficult concept iin the simple way. I was quit out of IT industry (exp 14 years) around 4 years back and starting doing business in the different verticle (Non-IT) but after seeing your videos got an interest to work again in IT and come back to work in Java with latest technologies.Since you are there for me to give technologies in the simplest way. I recalled all my 14 years of experience in 2 days. Really appreciate for your effort on this. Salute to Naveen. Thanks Subash C
Sir I cant stop watching your videos....I open laptop to learn some DSA and end up watching your videos one by one. Damn Naveen sir your are awesome. God bless you. :D
Thanks for this session Naveen. Jsut want to be more clear,Could you exactly differentiate the difference between abstract class and interface since both are defining methods in java 8?
Navin is Awesome, no matter how long the video size is, my same interest levels would continue throughout the video from starting till ending, excellent explanation skills he has...Yes, Navin is a Gold mine, Diamond, and even more than that. We are all so lucky to have him. Love you brother :), I wish God bless you with lots of energy, skills, and continued enthusiasm towards sharing knowledge like this
HI Navin, I kept watching and learning through your tutorials. Your way of teaching is good. My only suggestion is , please use real world example for every concepts which helps to understand quick and remember the concepts for long go :)
11:14if we implement both interface in one class .. 11:15 define the show(); in Class C, then which method should call?? class C method, or interface I's method or interface J's method
Very well explained the concepts and difference between the interface and abstract class with perfect example and explanation in an easy way. Thq so much dear👍👏🤗
An interface is a way of grouping classes. The reason for this is that any class that implements that interface must "do" all the methods that are written in that interface. So if there is an interface called "animal" which has methods: eat, sleep, walk, run, jump, then we have a bunch of classes for different types of animals, we would "group" all the different animal classes together by making them all implement the interface which means they must all "do" the methods in the interface, because those methods are common to them all. If that sounds exactly like inheritance with an abstract parent class that's because it is. The reason that an interfaces are used instead of regular abstract class inheritance is because in Java a class can only have one parent class but can many interfaces interfaces. If a class could have multiple parent classes then there would be no point in interfaces.
I have looked at several tutorials ... I consider myself a perfectionist and I like to learn, not only to know a programming language from above without going into the details. By your way of explaining I can see the passion you give to your videos and when I look at them, I have the security of learning, because you go to the smallest detail. You are very perfectionist and this is really appreciated ... There is no other course, which has caught me like this ... I really appreciate it.
14:07 what if we remove 'public' from class A 's show() method and tried implementing 'I' and extending 'A' ? Is this priority given on the basis of methods access modifiers ? or on the basis of class or interface?
i have doubt about 12:00 bcoz you created two interfaces and one class. and then you wrote a show method and you said we must define show method also in C class, then we ran program and which show is called from class to interface I or J?
11:51 I think that even when you have the diamond problem, you can still invoke the interface's default method from the class definition by calling either I.super.show() or J.super.show() Let me know if that sounds correct. stackoverflow.com/questions/19976487/explicitly-calling-a-default-method-in-java
Thanks you for you videos . Have question When our class ‘C’ implement ‘I’ and ‘J’ as you said we should override the common method to avoid errors . When we use third party libraries , if our class implement two interfaces if both having same method in there interfaces as per tutorial we should override common method , but here we don’t know the business logic of interfaces common method . Could you pls explain this
Hi Sir, I love the way you explain, at last you told we can access static method of the interface n main like (I.show()) method without creating object of interface I. But is it mandatory to implement the interface? could you please elaborate static methods.
@@logic_master950 But that s not true anymore since 1.8. That s what he explained in this video. I still dont see a difference now between those two classes
want to add 1 point here, If class C implements both the Interface I & J then its not necessary for class C to give the definition of static method (provided you are not calling it in your class C) but its necessary to for class C to give the definition of default methods (even though your are not calling it in your class C)
I think you have deviated from the actual point. At around 3:00 you were saying that defaults methods are introduced so that we can use the new features like Stream API, etc.. But you deviated from that point and talked on rules of default methods. Can you please bring clarity on how Java developers benefit in using default methods to use new features of Java8 thank you.
I have one doubt in last few mins. You said at 15:50, that if we define method inside interface and the same method is override in the implementing class it won't work. I think you are wrong here. It will call local method and won't generate error. Correct me if I didn't understand of taken it wrong.
Hi Navin, Thanks for explaining in such a good way. I have one doubt about both abstract class and interface can have methods with implementation in Java 8. Then what is difference between both ? Where should we use abstract class and where we can go with interfaces ?
You obviously can define methods in an interface, but it isn't *designed* for that. Do it if you have no other choice, (just like List did it for backward compatibility). Interfaces are designed for 100% abstraction. They, moreover don't tell what your class *is, but rather, what it can do (which is why we name them with an adjective rather than a noun).* Realize an interface doesn't affect its implementor much. You could easily retrofit your class to implement or unimpliment an interface, without changing the existing implementation (even if it's already a subclass, due to multiple inheritance). This is impossible with an abstract class, as their subclasses hugely rely on them. Hence, when you have to implement methods, and your subclasses rely on their parent's implementation, choose an abstract class. Else if you wanna just define the behavior of a class, choose an interface.
When we doesn't know any implementation at all, we only have requirement specification then in such cases we go for interface. And when we know implementation but not completely (partial implementation) then we go for abstract class
Navin, So I understand that up until 1.7, we can do multiple inheritance with interfaces because interfaces dont implement methods. And Im assuming that the answer to why we cannot inherit from mutiple classes, even if the classes are abstract is that these abstract classes CAN all implement the same methods. Coming to Java 1.8, what is the benefit of making it possible to implement methods in interfaces? If we can inherit from multiple interfaces that all implement the same methods, and then have to implement the method again in the child class, then what is the benefit. We have to implement the same method thrice. Also this is like inheriting from multiple classes, so what is the reason for this new interface definition?
1) Can we use default methods in abstract class or simple class?? 2) As now Interfaces are not 100% abstract, what difference is left now between abstract classes and interfaces?
2) Basically, abstract classes allow you to define instance variables whereas interfaces don't. Abstract class can also extend other abstract class. There are other differences (which I am too lazy to think about :d) 1) Yes, you can implements an interface which has default method and use it in abstract and concrete class.
In this you explained like when we have two interface with same method , in that case we have to override that method in the class. after that i didn't understood are we calling the implement methods or what we are doing after overriding
At 3.10 you said stream() method is introduced in List interface from Java 1.8 I think this is wrong. There is nothing like stream() method in List interface
My question is say // as said in e.g., inteface I { default boolean equals(Object o) { return true; } class Object { public boolean equals(Object obj) { return (this == obj); } } // it is extending object class by default class A implements I { } class B { A obj = new A(); obj.show(); // what will happen here is, as said in the video, class methods overtakes Interface default methods. this will call / // //Object.equals() only. } So potentially we can allow it right ?
useful. but still m not able to understand .. what's the difference between abstract class and interface... basically want to know when to use abstract class and when to use interfaces...?
Interface we can use when we want strict implementations like overriding all the methods in the implementation class but if we wish to have some special characteristics only and not all the methods then we can use abstract method. When you have a requirement where your base class should provide default implementation of certain methods whereas other methods should be open to being overridden by child classes use abstract classes.
can you explain the purpose of Abstract class in java8 when we have interface with default method. would appreciate if you comment or create a video on this. Thanks for providing awesome learning experience for all of us.
- Sir..., There's a little confusion... Don't we have to write a keyword *default* before static void show() inside Interface I (with reference to the discussed example) as you told earlier we have to use default keyword while defining method inside interface. Looking forward for your reply....
sir u have explained very well that why we should have a default method in java 1.8 interface but please can u elaborate the significance of having the static method in interface too with any real time scenario or example like u have explained for default one because I don't see any practical requirement of doing that.
I watched two hours of Navin's tutorials and I'm just trying to get a refresher on Java. I'm so upset that he wasn't around the years when i was learning Java. If you are starting to learn Java and come across Navin's playlist... it's like you've discovered a gold mine. Now i'm basically watching the rest of his tutorials because he's so clear and fun to watch.
I totally agree
yeah he is diamond
@@bhavik.kothari Totally agreed. Alot of videos on programming are either extremely boring to listen to or they're not as concise. Thank you Navin
But these videos are of older versions of Java. Many advancements took place in these days. If those advancements are too covered it'll be more helpful for the fresher's now
I dont mean to be off topic but does someone know of a tool to get back into an instagram account?
I somehow forgot my login password. I would appreciate any tips you can offer me.
The way you have explained I have never seen such an easy tutorial about basics of Lambda express in Java.
Been trying to learn Java through books, udemy courses, articles, and so far you're the best teacher I've found. Thanks,really. I've been stuck with some subjects like interfaces and your videos are clearing my doubts.
Thanks for this amazing tutorial Navin. You are saviour. Just would to add something. If there are two interfaces which define the same method (Ex: show()), then the class that implements these two interfaces does not always have to define the same method. Instead, it can use the "super" keyword like below which will also work.
.super.show();
Nonetheless, thanks a lot once again. You are an amazing teacher.
Hi Prem, actually in this case you have to define the show() method in your class and then you can choose to call show() method in your definition by using InterfaceName.super.show();
I am watching this years later and still so relevant,its such a great quality content. I have not found anyone explaining java and making is to easy to understand and learn.Thank you for your hard work sir. Its really helpful
This is the most comprehensive video I have ever seen on default and static keywords. So many details listed out with such a simple and evenly paced delivery! You, sir, are simply amazing!
This is a gold quality information, take a bow Navin! I know this because I have been here for a while now and having worked with Java for 5ish years, I have rarely found such good quality videos. Pure Gold!
Indeed!
I was watching your videos past 3 days. i was really immpressed and appreciate your efforts to explaining the difficult concept iin the simple way. I was quit out of IT industry (exp 14 years) around 4 years back and starting doing business in the different verticle (Non-IT) but after seeing your videos got an interest to work again in IT and come back to work in Java with latest technologies.Since you are there for me to give technologies in the simplest way. I recalled all my 14 years of experience in 2 days. Really appreciate for your effort on this. Salute to Naveen. Thanks Subash C
your making everything dead easy to be understood with your explanations!!! you are amazing!! thank you very very much!!!!
Navin sir... I must say... ur explanation is too good... u make things easy... by taking the exact appropriate cases... Thank you so much...
it was nice listening so for and thank you for putting your effort in teaching us.
Sir I cant stop watching your videos....I open laptop to learn some DSA and end up watching your videos one by one. Damn Naveen sir your are awesome. God bless you. :D
Perfect tutorial. If anybody has to know about the Default Method in java 8. Please go through this video and I recommend this.
Thanks for this session Naveen. Jsut want to be more clear,Could you exactly differentiate the difference between abstract class and interface since both are defining methods in java 8?
Your tutorial is not so long and also not so short. Your tutorial are really perfect
Navin is Awesome, no matter how long the video size is, my same interest levels would continue throughout the video from starting till ending, excellent explanation skills he has...Yes, Navin is a Gold mine, Diamond, and even more than that. We are all so lucky to have him. Love you brother :), I wish God bless you with lots of energy, skills, and continued enthusiasm towards sharing knowledge like this
Thank you so much Navin for the wonderful explanation. If possible, please provide sessions on Spring Batch, and Microservices.
HI Navin,
I kept watching and learning through your tutorials. Your way of teaching is good.
My only suggestion is , please use real world example for every concepts which helps to understand quick and remember the concepts for long go :)
yes sir please suggest this question
Yes my concern is also that.
11:14if we implement both interface in one class .. 11:15 define the show(); in Class C,
then which method should call??
class C method, or interface I's method or interface J's method
Your are explaining the concepts very beautifully and with ease. The way you explained the concepts with real time examples are really awesome.
Amazing teaching Naveen reddy...so crystal clear...
Very well explained the concepts and difference between the interface and abstract class with perfect example and explanation in an easy way. Thq so much dear👍👏🤗
Hi Navin,
I became your fan and a "chela" after this video! Awesome work, sir! Thanks a lot!!
Yes. same here. He doesn't create complexity and very centric to make other understand. Great Job Sir.
did somebody say 'Thanksalot'?
u r such a amazing teacher sir..you have clear my all concept..thank you sir..
You're amazing.. Hats off to you Naveen. No book can describe with such an ease. Kudos.. Keep on posting more videos :)
He is the best with his style.! And his signature is "HI ALIENS" :)
You are the reason behind my earning in software field.thanks a ton.keep doing videos for geeks like me.Waiting for more videos
It feels so good to learn from you!! I have no words to explain it. Others will understand for sure!!!
At 14:35 can you please tell me how you know this "Third Rule " in java 8 .. Have you google it or explore it on your own..
An interface is a way of grouping classes. The reason for this is that any class that implements that interface must "do" all the methods that are written in that interface. So if there is an interface called "animal" which has methods: eat, sleep, walk, run, jump, then we have a bunch of classes for different types of animals, we would "group" all the different animal classes together by making them all implement the interface which means they must all "do" the methods in the interface, because those methods are common to them all. If that sounds exactly like inheritance with an abstract parent class that's because it is. The reason that an interfaces are used instead of regular abstract class inheritance is because in Java a class can only have one parent class but can many interfaces interfaces. If a class could have multiple parent classes then there would be no point in interfaces.
I have looked at several tutorials ... I consider myself a perfectionist and I like to learn, not only to know a programming language from above without going into the details. By your way of explaining I can see the passion you give to your videos and when I look at them, I have the security of learning, because you go to the smallest detail. You are very perfectionist and this is really appreciated ... There is no other course, which has caught me like this ... I really appreciate it.
I just love the way he starts with the word “welcome back aliens” 🤓
14:07 what if we remove 'public' from class A 's show() method and tried implementing 'I' and extending 'A' ? Is this priority given on the basis of methods access modifiers ? or on the basis of class or interface?
i have doubt about 12:00 bcoz you created two interfaces and one class. and then you wrote a show method and you said we must define show method also in C class, then we ran program and which show is called from class to interface I or J?
Great level of teaching!
Your Java 8 - Interface lession is perfect.
Thank a lot sir for explaining it in a pretty simple way.
Thanks a lot naveen reddy for these tutorials. You are one of my favourites when it comes to programming tutorials. The tutorials are perfect.
Then what is the profit of defining show in interface I and J ? Referring to third rule example 14:20
11:51 I think that even when you have the diamond problem, you can still invoke the interface's default method from the class definition by calling either I.super.show() or J.super.show() Let me know if that sounds correct. stackoverflow.com/questions/19976487/explicitly-calling-a-default-method-in-java
I've explain this point in my course
Exactly that's what am thinking 🤔
Thanks you for you videos .
Have question
When our class ‘C’ implement ‘I’ and ‘J’ as you said we should override the common method to avoid errors .
When we use third party libraries , if our class implement two interfaces if both having same method in there interfaces as per tutorial we should override common method , but here we don’t know the business logic of interfaces common method .
Could you pls explain this
Good one Navin... Very helpful in understanding java 8 concepts..
Navin is the best guy to learn java. Thank you so much
great explanation for interview
All C++ concepts are coming back in Java!
Those who worked with C++ will find this easy! :)
telusko more powerfull than class ,class more powerfull than interface...done ive said it
Very well explained with examples, simply brilliant
Hi Sir, I love the way you explain, at last you told we can access static method of the interface n main like (I.show()) method without creating object of interface I. But is it mandatory to implement the interface? could you please elaborate static methods.
The word hidden by [Telusko] at 14:20 is "ThirdRules"
We are not "DEAF" buddy.
Navin Reddy, You teach Great
U made this concept so easy.....👍👍
Hi Navin,
Thank you and nicely you explained, I have one doubt, what is the difference between abstract class and interface in Java 1.8?
Interface only built with abstract methods(pure virtual functions). No defined method allowed in interface.
Interface only can have abstract method
@@logic_master950 But that s not true anymore since 1.8. That s what he explained in this video. I still dont see a difference now between those two classes
@@DR-pi9vk thanks a lot , dear
Thank you so much Navin for this video .. it's very helpful
The mention of function declarations in C was helpful.
🙏 This is awesome! Please dont stop. Hope it benefits you a lot.
Very well explained. Thanks Navin
want to add 1 point here, If class C implements both the Interface I & J then its not necessary for class C to give the definition of static method (provided you are not calling it in your class C) but its necessary to for class C to give the definition of default methods (even though your are not calling it in your class C)
I think you have deviated from the actual point. At around 3:00 you were saying that defaults methods are introduced so that we can use the new features like Stream API, etc.. But you deviated from that point and talked on rules of default methods.
Can you please bring clarity on how Java developers benefit in using default methods to use new features of Java8
thank you.
Wow! Amazing! Loved it! Thank you!
thank's with this vedio I got some idea of interface
Its so good for us, please explain all new features in java 8, if it is having more.
I have one doubt in last few mins. You said at 15:50, that if we define method inside interface and the same method is override in the implementing class it won't work. I think you are wrong here. It will call local method and won't generate error.
Correct me if I didn't understand of taken it wrong.
he mentioned it will take from class method rather than interface
Really useful content !! Thanks for your videos.
Thank you, sir, for a good lesson!!!
Best teacher ever!
Hi Navin sir,
Example u explained using third rule is always calling first interface rather than the class which is extended
Hi Navin,
Thanks for explaining in such a good way. I have one doubt about both abstract class and interface can have methods with implementation in Java 8. Then what is difference between both ?
Where should we use abstract class and where we can go with interfaces ?
You obviously can define methods in an interface, but it isn't *designed* for that. Do it if you have no other choice, (just like List did it for backward compatibility). Interfaces are designed for 100% abstraction. They, moreover don't tell what your class *is, but rather, what it can do (which is why we name them with an adjective rather than a noun).* Realize an interface doesn't affect its implementor much. You could easily retrofit your class to implement or unimpliment an interface, without changing the existing implementation (even if it's already a subclass, due to multiple inheritance). This is impossible with an abstract class, as their subclasses hugely rely on them. Hence, when you have to implement methods, and your subclasses rely on their parent's implementation, choose an abstract class. Else if you wanna just define the behavior of a class, choose an interface.
No doubt video is helpful but not complete. For that we can use show(){A.super.show(); B.super.show();} whichever implementation you can call.
When we doesn't know any implementation at all, we only have requirement specification then in such cases we go for interface. And when we know implementation but not completely (partial implementation) then we go for abstract class
sir you deserve an Oscar for the way of your teaching. THANKYOU
Navin, So I understand that up until 1.7, we can do multiple inheritance with interfaces because interfaces dont implement methods. And Im assuming that the answer to why we cannot inherit from mutiple classes, even if the classes are abstract is that these abstract classes CAN all implement the same methods. Coming to Java 1.8, what is the benefit of making it possible to implement methods in interfaces? If we can inherit from multiple interfaces that all implement the same methods, and then have to implement the method again in the child class, then what is the benefit. We have to implement the same method thrice. Also this is like inheriting from multiple classes, so what is the reason for this new interface definition?
Your way of explaining things, and sentence construction is great bro.
keep up the good work.
Good Video sir and thanks for provide some information related to java 8
excellent video, pretty clear.. I don't know why 28 dislikes
Really explained well. Thank You. Can we use super keyword to solve default methods diamond problem
Great explanation, valuable info. Thank you Navin!
You rock Navin, I am your fan
I like this lecture Very much! Thank you !
Sir! Your Tutorials are really helpful. Thanks
check my course about java 8 :)
1) Can we use default methods in abstract class or simple class??
2) As now Interfaces are not 100% abstract, what difference is left now between abstract classes and interfaces?
2) Basically, abstract classes allow you to define instance variables whereas interfaces don't. Abstract class can also extend other abstract class. There are other differences (which I am too lazy to think about :d) 1) Yes, you can implements an interface which has default method and use it in abstract and concrete class.
In this you explained like when we have two interface with same method , in that case we have to override that method in the class. after that i didn't understood are we calling the implement methods or what we are doing after overriding
Hi sir,
What is the main advantage of this feature? Will this effect old version implementation .
Hi Naveen you are just awesome... god bless you and keep uploading videos it really helps me. thanks a lot.
At 3.10 you said stream() method is introduced in List interface from Java 1.8
I think this is wrong. There is nothing like stream() method in List interface
We have stream() in Collection interface in java 8
My question is
say
// as said in e.g.,
inteface I
{
default boolean equals(Object o)
{
return true;
}
class Object {
public boolean equals(Object obj) {
return (this == obj);
}
}
// it is extending object class by default
class A implements I
{
}
class B
{
A obj = new A();
obj.show(); // what will happen here is, as said in the video, class methods overtakes Interface default methods. this will call / // //Object.equals() only.
}
So potentially we can allow it right ?
Hi Navin. Thanks for info. But can we add static main method in interface. If yes then how to execute it ?
Excellent session, cleared many concepts.
Thank you for a very good explanation. I have been using default methods a lot, but never occured to me there are limitations
Waaaah too good you should have been my professor in college time 🤗
wonderful, thanks a lot. One question, what is the main use of static methods in interface, I just like to know real time example for the same
really good man - highly rate your great explanation. Thanks
useful. but still m not able to understand .. what's the difference between abstract class and interface... basically want to know when to use abstract class and when to use interfaces...?
Interface we can use when we want strict implementations like overriding all the methods in the implementation class but if we wish to have some special characteristics only and not all the methods then we can use abstract method. When you have a requirement where your base class should provide default implementation of certain methods whereas other methods should be open to being overridden by child classes use abstract classes.
Very cool explanation with some very good examples. Keep it up!
wonderful work big like
can you explain the purpose of Abstract class in java8 when we have interface with default method. would appreciate if you comment or create a video on this. Thanks for providing awesome learning experience for all of us.
and why do we need to implement and make our own method in the class c ?
- Sir..., There's a little confusion... Don't we have to write a keyword *default* before static void show() inside Interface I (with reference to the discussed example) as you told earlier we have to use default keyword while defining method inside interface. Looking forward for your reply....
Thank you sir, it's really helpful. Very well explained.
Great explanation !
loved it . Thanks Navin
sir u have explained very well that why we should have a default method in java 1.8 interface but please can u elaborate the significance of having the static method in interface too with any real time scenario or example like u have explained for default one because I don't see any practical requirement of doing that.
Good work Mr Naveen Sir
One of the best video of your channel. Thanks :)