- Tubelator AI
- >
- Videos
- >
- Education
- >
- Exploring Core Java Concepts: OOPs(Object Oriented Programming) Part-4 - Overloading
Exploring Core Java Concepts: OOPs(Object Oriented Programming) Part-4 - Overloading
Gain a deep understanding of overloading in Object Oriented Programming as we delve into important concepts and cases. Prepare for your OCJP/SCJP exam and nail your upcoming interviews with key insights and knowledge on this vital Java concept.
Instantly generate YouTube summary, transcript and subtitles!
Install Tubelator On ChromeVideo Summary & Chapters
No chapters for this video generated yet.
Video Transcript
So, in the last session, so just we started about overloading, one of very important concepts
of whoops, overloading concept just we started right.
Now my next target here is related to overloading, there are several important loopholes are
there.
Ok, what is overloading?
Everyone can aware.
But what internal loopholes?
Let me talk around 5 to 6 cases so that you people can feel comfortable with overloading
right.
but every case very important for the exam, very important for the interview room.
Now let me go for case 1.
Let me go for case 1 here.
Just observe.
Sir, I am taking class test.
Now very very important case.
Class test.
Here public, public.
public void m1 of int i, sir public void m1 of int i, system.out.println int arg method,
int arg method, public void m1 of int i, int arg method.
Next, public wire M1R floatf system.out.println floatarc method floatarc method.
Ok.
So, total how many methods are there?
There are two methods.
Can I use the term these two methods are overloaded methods or not?
Yes, because both the methods having same name but different argument types.
That's why I can use the word, these two methods are what?
Overloaded methods.
These two methods are overloaded methods.
Next up, here see public static void main method, public static void main method string
array aux, public static void main string array aux.
Now tester T is equal to new tester, now tester T is equal to new tester.
Now I am calling T dot M1 method by passing 10 as the argument.
So T dot M1 of 10, 10.
Can you tell which method will get the chance now?
Ah, inter-arg.
Because exact match is always going to get high priority.
Inter-arg, right.
Inter-arg.
Next, T dot M1 of 10.5.
f, t dot m1 of 10.5 f, can you tell what the answer we are going to get now, float arc,
float arc, sir inter argument and float arc method, right, next term, t dot m1 of, here
just observe, at this stage, so at this stage let me explain one small, small example or
small, you know what experience I have, a funny experience I have related to this example.
Few years back, almost around 4 or 5 years back, I was taking only one batch, morning
7 to 9 batch only.
So if the class is started, ok then after 2 months the batch will be there.
So these many number of batches won't be there at that time.
Then what happened is, so one time I was there in the reception chair, then the number of
students are coming.
also 4 or 5 members, very less number of students are there, only 10 members are there in that