#4.5 Java Tutorial | Method and Constructor Overloading

  Рет қаралды 151,757

Telusko

Telusko

6 жыл бұрын

In this lecture we are discussing:
1) What is method overloading
a) what is necessary condition for method overloading?
b) example
2)what is constructor overloading ?
a)what is necessary condition?
b) example
#1
Method overloading:
:- In a same class we have more than or equal to two methods with same name
but with different parameters.
a)Necessary condition
i)at least two methods with same name in class.
ii)different parameters in methods might be of different data tyoe or nuumber of parameters are different
e.g add(int num1, int num2) , add(int num1, intnum2, int num3), add(float num1, float num2), add(int num1, float num2)
iii)return type might same or different does not matter
e.g public int add(int num1, int num2) public void add(int num1, int num2) is not overloaded because return type does not effect any change.
you got error when you want to do like this //Duplicate method add(int, int) in type
b)example
class Calc{
public void add(int num1,int num2){
}
public void add(float num1,float num2){
}
public void add(int num1, int num2 ,int num3){
}
public void add(int num1, float num2){
}
}
#2
Constructor overloading
:- I understand everyone understand constructor is a member method of a class
a)Necessary condition for constructor overloading
:- it just same as method overloading name must be same and parameters must be different .
e.g Calc(), Calc(int num) ,Calc(int num1, int num2)
b)example
class Calc{
int num1;
int num2;
Calc(){
//non -parametrized constructor
}
Calc(int num1){
this.num1=num1; //parametrized constructor with single parameters
}
Calc(int num1, int num2){
this.num1=num1;
this.num2=num2;
}
}
In this video we will see :
- Passing multiple parameter in method
- Creating multiple methods having same name
- Why we need method overloading
- Constructor overloading
- How overloading works
Github :- github.com/navinreddy20/Java-...
Instagram : / navinreddyofficial
Linkedin : / navinreddy20
Discord : / discord
More Learning :
Java - bit.ly/3xleOA2
Python :- bit.ly/3H0DYHx
Django :- bit.ly/3awMaD8
Spring Boot :- bit.ly/3aucCgB
Spring Framework :- bit.ly/3GRfxwe
Servlet & JSP :- bit.ly/3mh5CGz
Hibernate Tutorial :- bit.ly/3NWAKah
Rest API | Web Service Tutorial :- bit.ly/38RJCiy
Git :- bit.ly/3NUHB3V
JavaScript :- bit.ly/3mkcFys
Kotlin :- bit.ly/3GR2DOG
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
www.telusko.com/contactus

Пікірлер: 57
@naveentandon993
@naveentandon993 4 жыл бұрын
This video is really helpful to me.... thnku so much Sir..... may God bless u always 🙏
@abhishekrath2031
@abhishekrath2031 4 жыл бұрын
Sir, in this pandemic condition your videos are helping me a lot;
@kalpitkadia
@kalpitkadia 4 жыл бұрын
Very simply explained, and that too in short. The way of explanation is also very good. I was going through the various Overloading videos but your video found to be short that's why landed here and I am glad that I landed at right place. You cleared the concept with an example and that really helped me to understand easily. Thank you so much for making such videos.. I will be going through your other videos as well for more learning..
@hamzakhalil9448
@hamzakhalil9448 6 жыл бұрын
This was extremely helpful. I have been struggling with constructor overloading for ages. Thanks heaps!
@yourtube3214
@yourtube3214 Жыл бұрын
So, your ages has ended within 5:23 minutes xD
@d-e-v-esh
@d-e-v-esh 4 жыл бұрын
Bahut dimag kharab hone ke bad ab jake samagh mai aaya is video se... Thank you sir. Being straightforward made this so simple...
@youssof.k.8736
@youssof.k.8736 4 жыл бұрын
simple, ethical and straight forward
@786Peacelover
@786Peacelover 6 жыл бұрын
Thanks very much for such useful stuff. I understood the concept now fully.
@jawaharsharma122
@jawaharsharma122 3 жыл бұрын
you are a GREAT TEACHER sir.
@chinmaydas4053
@chinmaydas4053 6 жыл бұрын
Waiting for your next constructor video.Sir please a video how to debug Java programmes in eclipse,netbeans & IntelliJ..it will be extremely helpful for all..please make sir 🙏🙏..
@H-CSELEKrishnaMohan
@H-CSELEKrishnaMohan 3 жыл бұрын
Man wtf you're explanation is so clear
@saidishapratisthan8483
@saidishapratisthan8483 6 жыл бұрын
Very useful information thanks sir
@AayushBartaula
@AayushBartaula 3 жыл бұрын
Excellent sir Thannkyou SOomuch super easy and great explanation
@sanjaiav3924
@sanjaiav3924 Жыл бұрын
This vdo is underrated
@hemantsharma4749
@hemantsharma4749 5 жыл бұрын
thankyou so much brother really helped.
@UjjwalKumar-oi6lf
@UjjwalKumar-oi6lf 2 жыл бұрын
such a nice explanation...please upload more videos sir
@itswinnie2012
@itswinnie2012 5 жыл бұрын
Thanks for your tutorials they really help me. Bless you.
@SmartProgramming
@SmartProgramming 5 жыл бұрын
awesome sir, the way you teach is really awesome, keep it up sir 👍👍👍👍🙂🙂🙂🙂
@namratasingh5564
@namratasingh5564 2 жыл бұрын
Hey Deepak sir😃...
@keshavrajacharya1145
@keshavrajacharya1145 6 жыл бұрын
you teaching technique is awesome.
@ashwanisaklani3241
@ashwanisaklani3241 4 жыл бұрын
Short video but it's much efficient 😊
@pratikgupta7373
@pratikgupta7373 6 жыл бұрын
Sir please make videos on servlet ... Million of videos are there in KZfaq on core Java
@Ben-my9bn
@Ben-my9bn 2 жыл бұрын
In real-time can we use both at a same time (method overloading and constructor overloading)?
@teluskosupport1
@teluskosupport1 Жыл бұрын
yes we are using sup[pose we import some class for our use, in that class we have overloaded constructor as well as overloaded method
@thangtran145
@thangtran145 4 жыл бұрын
Thanks Telsuko, you're very helpful. If only you could talk slower that would be amazing!
@meshalals7517
@meshalals7517 4 жыл бұрын
thank you so much
@TheLionheartCenter
@TheLionheartCenter 4 жыл бұрын
THANK YOU
@aditithakur5349
@aditithakur5349 3 жыл бұрын
Thanks alot!!!
@LukaszSkyWalker
@LukaszSkyWalker 6 жыл бұрын
BigThx!!
@krishnaprasanna6741
@krishnaprasanna6741 2 жыл бұрын
Sir is it compulsory to take the main method in other class.....without directly implementing in the given first class....?
@rushikeshkankonkar585
@rushikeshkankonkar585 6 жыл бұрын
plzz make video on how to make game in java
@onlineyash1721
@onlineyash1721 Жыл бұрын
Make a lesson about difference b/w Method and Constructor
@shaikidris2000
@shaikidris2000 10 ай бұрын
hello sir, can we create multiple objects in construtor overloading?
@shahrulmazlany0644
@shahrulmazlany0644 3 жыл бұрын
❤️👍
@SagarSagar-ro3fj
@SagarSagar-ro3fj 6 жыл бұрын
Sir..make a video on compile time binding and run time binding..2 houra wasted on internet reading stuff saying binding done at compile time and rutime...😂 but wat the hell is runtime and compile time and hiw it actually takes place and how things move nobody is yet able to tell..can you help us.. Also let us know the same code how it works and what will be the execution at compile time and runtime
@pathakamuricharankumar4682
@pathakamuricharankumar4682 3 жыл бұрын
Sir make a video on differences between method and constructor
@teluskosupport1
@teluskosupport1 Жыл бұрын
constructor is special type of setter method which has no return type . but method has return type
@arjunmr2631
@arjunmr2631 5 ай бұрын
Create class i understand this concept easily
@arpita0608
@arpita0608 5 жыл бұрын
suppose we want to add infinite numbers then what should we do .i mean if its user choice to add n no.s then?
@teluskosupport1
@teluskosupport1 Жыл бұрын
variable length argument concept. public class Main { int num1=5; int num2=7; public void add(int ...num) {int sum=0; for(int x:num) { sum=sum+x; } System.out.println(sum); } public static void main(String args[]) { new Main().add(1,2,3,4,5,6); } }
@shaswatiganguly4672
@shaswatiganguly4672 Жыл бұрын
2:59 constructor overloading
@pavanteja2219
@pavanteja2219 2 жыл бұрын
Are there any advantages of this thing ?
@shohaib963
@shohaib963 Жыл бұрын
Sir dikhte khatarnak par sikhate acha 😂
@abhijeetkumar2100
@abhijeetkumar2100 5 жыл бұрын
the constructor part code is not working...can u plzz chk line no.41 in your code and explain it.!!
@teluskosupport1
@teluskosupport1 Жыл бұрын
they call constructor of 3 argument
@sumitshende1418
@sumitshende1418 3 жыл бұрын
How can u overload in two different classes 🤔🤔
@praveenkumarguttapalyam2190
@praveenkumarguttapalyam2190 4 жыл бұрын
Hey why are you running so fast when you have awesome knowledge?
@ritesha8050
@ritesha8050 2 жыл бұрын
can the return type change???
@teluskosupport1
@teluskosupport1 Жыл бұрын
yes in overloading a method return type can change.
@myprofile702
@myprofile702 6 жыл бұрын
What happened to servlet nd jsp series sir 😞
@myprofile702
@myprofile702 6 жыл бұрын
Telusko Learnings will be waiting I need it badly for interviews... Thnx
@devononiel
@devononiel 3 жыл бұрын
Not to be rude but you have a very strong accent and your moving wayy too fast. Slow down man!
@rehankhaled4886
@rehankhaled4886 5 жыл бұрын
will it not be code redundancy?
@thanos9704
@thanos9704 5 жыл бұрын
no, he is not using same method.
@amanshaw291
@amanshaw291 2 жыл бұрын
i quit! because of java
@profaiz1
@profaiz1 3 жыл бұрын
lol, wtf ? is it this easy ?
@shaibalahmed9317
@shaibalahmed9317 3 жыл бұрын
Dude your content is good, but you talk so fast. might wanna tone it down a bit!
#4.6 Java Tutorial | Static Keyword
12:20
Telusko
Рет қаралды 448 М.
Java Classes & Objects
11:36
Keep On Coding
Рет қаралды 303 М.
LOVE LETTER - POPPY PLAYTIME CHAPTER 3 | GH'S ANIMATION
00:15
The child was abused by the clown#Short #Officer Rabbit #angel
00:55
兔子警官
Рет қаралды 24 МЛН
Became invisible for one day!  #funny #wednesday #memes
00:25
Watch Me
Рет қаралды 50 МЛН
Super Keyword in Java Full Tutorial - How to Use "super"
11:33
Coding with John
Рет қаралды 196 М.
Java overloaded constructors 🍕
8:02
Bro Code
Рет қаралды 66 М.
Functional Interface | Lambda Expression in Java
13:56
Telusko
Рет қаралды 138 М.
#52 Method Overriding in Java
7:57
Telusko
Рет қаралды 115 М.
OVERLOADING CONCEPT - JAVA PROGRAMMING
29:05
Sundeep Saradhi Kanthety
Рет қаралды 189 М.
Java overloaded methods ☎️
5:39
Bro Code
Рет қаралды 77 М.
#66 What is Interface in Java
8:03
Telusko
Рет қаралды 169 М.
#7.1 Java Tutorial | Interface | Why and What?
7:14
Telusko
Рет қаралды 142 М.
Clicks чехол-клавиатура для iPhone ⌨️
0:59
ИГРОВОВЫЙ НОУТ ASUS ЗА 57 тысяч
25:33
Ремонтяш
Рет қаралды 336 М.
Main filter..
0:15
CikoYt
Рет қаралды 15 МЛН
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 2,1 МЛН