Functions / Methods in Java

Sdílet
Vložit
  • čas přidán 3. 07. 2024
  • All about #functions in Java from scratch! In this video, we cover in detail functions/methods in Java.
    Starting with the syntax, we cover topics like types of arguments, how values are passed, scoping, shadowing, function overloading, with examples.
    Take part in the learning in public initiative! Share your learnings on LinkedIn and Twitter with #DSAwithKunal & don't forget to tag us!
    👉 Resources
    - Join Replit: join.replit.com/kunal-kushwaha
    - Complete Java DSA playlist: • Java + DSA + Interview...
    - Code, Assignments, & Notes: github.com/kunal-kushwaha/DSA...
    ➡️ Connect with me: www.techwithkunal.com
    =========================================
    Timestamps:
    0:00 Introduction ‌‍‍‍‌‌‍‍ ‌‍‍‌‌‌‌‍ ‌‍‍‌‍‍‌‍ ‌‍‍‌‍‌‍‌ ‌‍‍‌‍‍‍‌ ‌‌‍‍‌‌‌‌
    1:58 Problem Statement
    5:31 Methods
    5:41 Syntax of a Method
    6:40 🎯 Program : Sum of two numbers
    9:11 🎯 Program : Greetings
    11:18 Returning Values
    14:31 Returning a String
    17:42 Parameters (Integer Function)
    20:36 Parameters (String Function)
    25:03 🎯 Program : Swap two numbers
    25:25 🎯 Program : Pass Value
    29:39 Internal Working of Swapping Program
    41:33 🎯 Program : Change Value
    46:41 Scope
    47:00 Method Scope
    49:46 Block Scope
    55:32 Loop Scope
    59:44 Shadowing
    1:06:53 Variable Arguments (Varargs)
    1:12:07 Method Overloading
    1:19:25 🎯 Questions
    1:20:01 Q1 : Prime Number
    1:23:52 Q2 : Check Armstrong Number
    1:28:27 Q3 : Print All 3 Digit Armstrong Numbers
    1:30:18 Outro
    #placement #dsa #interviews

Komentáře • 726

  • @suvojitghosh2774
    @suvojitghosh2774 Před 2 lety +430

    Man the explanation is so perfect . Concepts of shadowing scoping varargs were made so easy. Great work!! Looking forward to Arrays❤️

  • @vasutiwari4187
    @vasutiwari4187 Před 2 lety +110

    I couldn't thank you enough, but i pray may god give you strength and power to complete this course and also do many things great in life. I believe that if this course goes the same way its going now it will change life of lakhs.Thanks for being a helping hand

  • @amritpaudel8204
    @amritpaudel8204 Před 2 lety +116

    To all the new comers : In 30:56 when Kunal says in Java there is no such thing as pass by reference he means that there is no any way by which we can pass the primitive data types as reference in java. For example in C++ we had & and * operators by which we could pass the memory address of any variable we want ( even primitive variables like int, char, float etc ) and we can always achieve pass by reference but in java there are no such & and * operators.
    But in java we do have certain reference variables like classes, arrays. Since they are already a reference variable passing them through function might look like a pass by reference but that is because the variable name already is a reference to data in heap memory. So DO NOT BE CONFUSED

    • @ashwathks784
      @ashwathks784 Před 2 lety +1

      Thank you

    • @abhinav2004
      @abhinav2004 Před rokem

      Thanks Amrit

    • @abhishekranjan1523
      @abhishekranjan1523 Před rokem +1

      in call by value example when he pass the primitive value to the function he tells that here we not change the value of the object we create the new object this is wrong and he didn't explain right

    • @_zoro
      @_zoro Před rokem

      thanks a lot

    • @vasanthnannuri8544
      @vasanthnannuri8544 Před rokem

      thanks dude

  • @arghasantra5420
    @arghasantra5420 Před rokem +20

    The best coding teacher i found in entire CZcams. You are just like beyond pro level ♥️

  • @ajitpandey4265
    @ajitpandey4265 Před 2 lety +195

    One more interesting observation about VarArgs:
    If you have 2 functions with the same name (i.e you are overloading a function)
    eg:- fun(int p,int q) and fun(int ...v)
    and if you call fun(10, 20) from the main function
    then function accepting the exact number of parameters( fun(int p, int q) in this case ) will be executed and VarArg function( fun(int ...v) in this case) will be ignored.
    hope it helps! :)

  • @ravijain3413
    @ravijain3413 Před 9 měsíci +4

    Very nice explanation, i am having more that 13 years of experience in java but still watching just to learn how you are teaching and explaining... very helpful for any new person who wants to understand java. Good job, much appreciated ... keep it up...as of now i have forwarded your chhanal link to more than 20 freshers... nice contribution towards community...

  • @hareeshanand4209
    @hareeshanand4209 Před 2 lety +115

    46:33 in java we dont have pointers....Me: Finally inner peace😂😂

  • @sainaid
    @sainaid Před 10 měsíci +4

    now you are my only hope to learn dsa in a much simpler way. your way of explanation is perfect and crystal clear. thank you so much for such amazing content. ❤

  • @Coding_Asmr_PraDev
    @Coding_Asmr_PraDev Před 2 lety +6

    Your teaching is highly comprehensible

  • @owaisnazirdar3575
    @owaisnazirdar3575 Před 2 lety +58

    It is not one of the best It is THE BEST course of DSA . Love you bro ❤❤

  • @yoursyasuo5868
    @yoursyasuo5868 Před 2 lety +76

    This is literally amazing explanation. I am at the 2nd year and still learnt alot from this amazing lecture!

  • @sarangvaliyaparambath810
    @sarangvaliyaparambath810 Před 2 lety +3

    Best in teaching. Clearing all doubts. Thankyou for this playlist.

  • @FlutterProject-zb8jm
    @FlutterProject-zb8jm Před 7 měsíci

    I've learned Python and Dart in the past, and this course is exceptional in quality and depth. I'm truly impressed and grateful for the in-depth content. Thank you, and may your work continue to benefit many more students. 💌

  • @aamirreza4222
    @aamirreza4222 Před 9 měsíci +2

    Although I had already viewed this lecture, I came back to learn the concept of scoping more clearly

  • @FreeAltSoftwareTutorials

    I just found the best way to understand scope.
    So think the outer variables as the king and the inner variables in a block or loop to be the common people.
    The king can visit the common peoples home at any time but common peoples can't visit the king usually.
    It's something I came up in my mind & thought would be helpful for you.

  • @shreysutariya2495
    @shreysutariya2495 Před 2 lety +19

    my whole java syllabus of college is done by here only
    thanks lot for making awesome videos

  • @tamannasharma1294
    @tamannasharma1294 Před 2 lety

    bhaiya kya clear kra h ye scoping ka concept ........🤩🤩

  • @satishgubge3800
    @satishgubge3800 Před rokem +1

    Your explanation is crystal clear . loved the style you teach the things so simply. You are doing great job ....

  • @karpagavalli8168
    @karpagavalli8168 Před rokem +1

    Such a great man.
    I have no words to express my gratitude 🙏🏻
    Thanks a lot

  • @CodeforTonight
    @CodeforTonight Před 2 lety

    Super se bhi upar hai ye DSA playlist..Kudos To Kunal

  • @user-wz3xe7cm9b
    @user-wz3xe7cm9b Před 5 měsíci

    Best paylist for DSA thank you so much kunal I started this just few days ago. I was very worried as I was not getting concepts . thanks for this great playlist❤

  • @PoojaVerma-tj7ls
    @PoojaVerma-tj7ls Před rokem +1

    I was always struggling with this scoping thing, now its clear thanks kunal :)

  • @anuragsisodiya7807
    @anuragsisodiya7807 Před 10 měsíci +1

    1:22:46 At line no.24 we can also use return true instead of c*c>n because if above two conditons fails then c*c>n has to be true

  • @shashwatsrivastava6899
    @shashwatsrivastava6899 Před 2 lety +4

    Thank you, Kunal for making videos even on weekends for us. :)

  • @Syed_Shahzil
    @Syed_Shahzil Před 10 měsíci +17

    Best DSA series ever I would like to say. Content made just for the sole purpose of teaching people. Thank you Kunal for such great explanations. you are truly a great Teacher.

    • @KunalKushwaha
      @KunalKushwaha  Před 10 měsíci +10

      It's my pleasure

    • @MuskanSoni-bg3ii
      @MuskanSoni-bg3ii Před 10 měsíci +2

      @@KunalKushwaha sometimes i wonder how you such a gentleman , thank you for this series .

  • @arnabkar3546
    @arnabkar3546 Před rokem

    Best course on DSA . Far superior than many paid ones.

  • @Yaduvanshi6532-Rohit-Yadav
    @Yaduvanshi6532-Rohit-Yadav Před 8 měsíci +1

    this is best method and function lecture for any one on the youtube.

  • @parmarjaynareshbhai6610
    @parmarjaynareshbhai6610 Před 2 lety +1

    You are putting video in sunday also.
    Really appreciate your work.
    And you are amazing teacher

  • @ayushsingh10399
    @ayushsingh10399 Před 2 lety

    Thanks brother you will going to create a new community with a student with best knowladge..

  • @sahilsood786
    @sahilsood786 Před 2 lety +9

    Couldn't have been explained in a better way. Keep growing and spreading your knowledge.

  • @DesiBalakAnuj
    @DesiBalakAnuj Před 2 lety +1

    Thank you for this course bro.... highly appreciated. Thanks a lot ☺️

  • @mdmujahid8968
    @mdmujahid8968 Před rokem

    Kunal is going clear all my doubts in DSA...loved it

  • @TxNet
    @TxNet Před 11 měsíci +3

    at 45:00 whosover is having doubt in change value read this: like in the video he has said that pass by value works on primitve datatypes like string, int char byte etc,whereas objects and stuffs like array which is not a primitive datatypes, its a reference variable(collection of ints or any data type that I declare) so that's why the value of arr[0] got changed since array itself was the reference.hope this might help

  • @anshsambhariya2194
    @anshsambhariya2194 Před 2 lety +1

    This will be an awesome one too!! I am commenting before even watching!! Thanks Kunal!

  • @neerajyadav2349
    @neerajyadav2349 Před 8 měsíci +1

    Loved the clear and correct explanation

  • @mrexplorer3433
    @mrexplorer3433 Před 2 lety

    The best bootcamp ever👌🏻
    really beneficial for all of us!.

  • @ud3695
    @ud3695 Před rokem

    The channel should be named "Hey Kunal"
    Love what you are doing sir. May God bless you.

  • @tiasghosh2825
    @tiasghosh2825 Před 2 lety +3

    Hey Kunal ur all vedios are so amazing that I can't express. Ur every vedio link that pops out I immediately click on that. Thank u so much for ur hard work and consistency. But plss don't stress urself so much upload vedios at ur own time ur health is also important.☺️☺️

  • @asumalkushwah3000
    @asumalkushwah3000 Před 2 lety

    You teach every single stuff very clearly

  • @manishagujjar2946
    @manishagujjar2946 Před 2 lety

    Finally I am satisfied with some lectures.thanks bhiya sooo much.

  • @uchiha__madara
    @uchiha__madara Před 2 lety

    Thank you Kunal for your smart work

  • @rajeshkamlekar8150
    @rajeshkamlekar8150 Před 2 lety +1

    Hey Kunal i appreciate your hardwork bro, try to complete the course as soon as possible,in 2 months.

  • @vaidehiparashar7202
    @vaidehiparashar7202 Před měsícem +1

    literally, you the cutie. to the point explaination. thank youuu sir!

  • @rajattiwari6697
    @rajattiwari6697 Před 2 lety +26

    Handwritten notes are the best for revising at the last moment. Amazing video Kunal ,Lots and lots of learning from this amazing lecture.

  • @avanishdubey6556
    @avanishdubey6556 Před 2 lety +1

    I don't know about shadowing and varargs before but now I know that very well.

  • @aryanparashar2407
    @aryanparashar2407 Před rokem +1

    Wow the explanation is just so perfect i can surely say that ur the best best best programmer and a teacher is well ur just the BEST!!!! u just explained all these topics so easily that these are damn impactfull and easily understandable 👌👌👍👍🙏🙌

  • @thomasphilip8158
    @thomasphilip8158 Před 2 lety +3

    Thanks for the late-night video!

  • @chandanan1993
    @chandanan1993 Před 10 měsíci +1

    Thank you so much sir. Its very clear to understand each concept. Teaching is very nice. waiting for more videos like these.

  • @SatyamKumar-lj5bi
    @SatyamKumar-lj5bi Před 2 lety +1

    Waiting for your dsa part ,i know basics of java ! ❤️

  • @pudipavankumar4952
    @pudipavankumar4952 Před 7 měsíci

    One of the best channel for java+dsa series

  • @ExploringOurBharat
    @ExploringOurBharat Před 5 měsíci

    Bro you are nailing this course....Thanks a lottttttttt

  • @RahulKumar-rx6sk
    @RahulKumar-rx6sk Před rokem

    love your lectures kunal , Best ever explanation❤❤

  • @swagatswaroopparida2201
    @swagatswaroopparida2201 Před 2 lety +12

    Thanks for such great videos. I am in class 10th and wanted to learn Java . Explanations are so simple that I can understand easily.❤️❤️
    Any tips for me?

  • @opakiriteibama1201
    @opakiriteibama1201 Před 9 měsíci

    You are much man, you handled java the way it is really easy to understand the concepts

  • @naveenscorp09
    @naveenscorp09 Před 2 lety +20

    Kunal you'll definitely grow in your career, even an experienced developer can't give this level of explanation for functions.Keep up

  • @asmithaikya
    @asmithaikya Před 2 lety +26

    Well bhaiya, currently I don't have time to watch these lectures but even then I make sure to leave a thumbs up to your every video coz we trust you with all our heart. And most importantly at the end me too will follow this series. ❤

    • @narc7885
      @narc7885 Před 2 lety

      Why can't you follow this series now? What are u so busy with

  • @utkarshmaurya6877
    @utkarshmaurya6877 Před 2 lety +1

    As always, amazing content ✌️✌️

  • @deepbansal8710
    @deepbansal8710 Před 5 měsíci

    Okay so, had to watch the Pass by value and pass by copy of the value of the reference part, to make it more clearer, but yes, u made it clear enough ! ❤❤❤❤

  • @AnkurKumar-wg3on
    @AnkurKumar-wg3on Před rokem

    amazing lecture kunal, hands on programming and problem solving is the best.

  • @mailchimp8763
    @mailchimp8763 Před 2 lety

    God bless you buddy! Great work for the community :)

  • @soumyaranjansahoo4100
    @soumyaranjansahoo4100 Před 11 měsíci +1

    Your teaching concepts are amazing bro❤

  • @anudey8496
    @anudey8496 Před rokem +1

    you are amazing bro!! much appreatiated 👏👏👏👏

  • @JpChandYouTube
    @JpChandYouTube Před rokem

    After watching more than 8 video...i found a better explanation in this video... love you bro

  • @vedanthbaliga7686
    @vedanthbaliga7686 Před 2 lety

    Superb video! Thanks Kunal

  • @anonymous1516
    @anonymous1516 Před 2 lety +1

    You have nailing it bro!!

  • @anujbisht3907
    @anujbisht3907 Před 2 lety

    this is the best thing i have come across

  • @deveshb793
    @deveshb793 Před 2 lety +29

    This is the best explanation on functions!🔥

  • @RajkamalKamal-bh9jq
    @RajkamalKamal-bh9jq Před rokem

    Lots of love🥰🔥Well explained each and every concepts

  • @DeepakKushwaha-ey8mj
    @DeepakKushwaha-ey8mj Před rokem

    awesome man the way you teaching in this age great ❤

  • @satyampandey3136
    @satyampandey3136 Před měsícem

    Thank you so much!! I really mean it.

  • @ShivamSingh-gc6pm
    @ShivamSingh-gc6pm Před rokem

    Thanku sir for this amazing lecture ❤🙏.

  • @im.rakesh0827
    @im.rakesh0827 Před 2 lety

    perfectly explained everything : You are doing great bhaiya

  • @ExploringOurBharat
    @ExploringOurBharat Před 6 měsíci +1

    Best out of Best Brother Hats offf to you...

  • @thecoderguy_0001
    @thecoderguy_0001 Před rokem +6

    For scoping to be simple , folks, global scope objects is accessed by other scopes, but not vice versa and,
    change in value in block scope may apply to global scope.

  • @mrexplorer3433
    @mrexplorer3433 Před 2 lety

    Great explanations! Kunal👍
    Keep it up.

  • @santhoshj985
    @santhoshj985 Před rokem

    Good teaching comes from a good heart

  • @ankitabiradar2112
    @ankitabiradar2112 Před 2 lety

    Ur video s are really helpful, and we can understand quick ....

  • @mohsinkhan973
    @mohsinkhan973 Před 2 lety

    Just Amazing, This Course is better than paid courses.

  • @manibhushankumar8669
    @manibhushankumar8669 Před 2 lety

    Finest Video on this topic . Great Job Man Hatt's off to u

  • @vasujhawar.6987
    @vasujhawar.6987 Před 2 lety +10

    Kunal, The shadowing and VarArgs explanation was great. Appreciate af.

  • @_hulk748
    @_hulk748 Před rokem

    Great Explanation Sir🙏🙇‍♂✨❤

  • @GangapuramArun-bu5qq
    @GangapuramArun-bu5qq Před rokem

    I thought that coding is hard after seeing your videos I am learning coding so easily...💥💥

  • @siddharthsahu7565
    @siddharthsahu7565 Před rokem

    amazing work man, appreciate it ♥

  • @samirajput9351
    @samirajput9351 Před 2 lety +1

    i have watched your previous videos and now I am giving likes to each of your video before even watching it Much respect

  • @sachinsinghrawat2344
    @sachinsinghrawat2344 Před 2 lety

    Completed. Waiting for the next

  • @ramannaagre7938
    @ramannaagre7938 Před rokem +1

    There's some magic in the way you teach.

  • @amansinghrajput9681
    @amansinghrajput9681 Před 2 lety

    Best course of all time

  • @narutodihargo
    @narutodihargo Před 10 měsíci +4

    Timestamps:
    0:00 Introduction ‌‍‍‍‌‌‍‍ ‌‍‍‌‌‌‌‍ ‌‍‍‌‍‍‌‍ ‌‍‍‌‍‌‍‌ ‌‍‍‌‍‍‍‌ ‌‌‍‍‌‌‌‌
    1:58 Problem Statement
    5:31 Methods
    5:41 Syntax of a Method
    6:40 🎯 Program : Sum of two numbers
    9:11 🎯 Program : Greetings
    11:18 Returning Values
    14:31 Returning a String
    17:42 Parameters (Integer Function)
    20:36 Parameters (String Function)
    25:03 🎯 Program : Swap two numbers
    25:25 🎯 Program : Pass Value
    29:39 Internal Working of Swapping Program
    41:33 🎯 Program : Change Value
    46:41 Scope
    47:00 Method Scope
    49:46 Block Scope
    55:32 Loop Scope
    59:44 Shadowing
    1:06:53 Variable Arguments (Varargs)
    1:12:07 Method Overloading
    1:19:25 🎯 Questions
    1:20:01 Q1 : Prime Number
    1:23:52 Q2 : Check Armstrong Number
    1:28:27 Q3 : Print All 3 Digit Armstrong Numbers
    1:30:18 Outro

  • @balajimunuswamy4159
    @balajimunuswamy4159 Před 7 měsíci

    Very very clean and really deep diving

  • @ShivamSingh-gc6pm
    @ShivamSingh-gc6pm Před rokem +1

    Thanks a lot Sir ji❤🙏.

  • @dayabhusal7519
    @dayabhusal7519 Před rokem

    Really enjoying this vdos

  • @pasito287
    @pasito287 Před 2 lety

    THanks for this course

  • @deadpool_0077
    @deadpool_0077 Před 2 lety +2

    The 'opportunities' playlist was very helpful, please start it if possible for community classroom too .

  • @maheshtekkina511
    @maheshtekkina511 Před rokem

    Very Good explanation never listened this type lecture in my carrier😊😊

  • @ZenHiker.
    @ZenHiker. Před 2 dny +2

    Day 16 of DSA leaning completed✅🙌

  • @amitanandanojha3419
    @amitanandanojha3419 Před 2 lety

    thanks bhaiya it is amazing lecture lot of small small concept i learned 😇😇😇

  • @bhargavikota2210
    @bhargavikota2210 Před 7 měsíci

    Really amazing teaching i never say like you i am very lucky to come your channel ❤️

  • @VisheshVerma1
    @VisheshVerma1 Před dnem

    All Concepts are well explained

  • @santoshkumarpanigrahi3059

    Really it's amazing explanation 💯

  • @shrirambalaji2109
    @shrirambalaji2109 Před 2 lety

    Thank you kunal .....