Final Keyword in Java Full Tutorial - Final Classes, Methods, and Variables

  Рет қаралды 124,585

Coding with John

Coding with John

Күн бұрын

Пікірлер: 116
@adrianlowery7175
@adrianlowery7175 2 жыл бұрын
You are a master teacher. You know in what order to teach concepts, which examples will best convey the concept, and how to simply TEACH! Your personality, your passion, and the feeling of ease that you give off is so amazing. You'd be a great streamer. You're a fantastic communicator
@turuus5215
@turuus5215 2 жыл бұрын
He is pretty good looking too.
@sebon11
@sebon11 2 жыл бұрын
Dude, it's impressive how extremely clear you are in how you teach. Seriously, i don't know if there's any second in this tutorial (and all others) that could've been done better. Impressive
@5n2joelemmanuel54
@5n2joelemmanuel54 Жыл бұрын
man you are amazing. i watched about 10 of your videos and understood each one of them. you are an amazing teacher john. have the utmost respect for you
@gabrielfono844
@gabrielfono844 Жыл бұрын
I dont know for some reasons, anytime I have issues , I just jump on your youtube channel and found a perfect solution. sir , I love what you are doing. love from herndon virginia
@dname1802
@dname1802 9 ай бұрын
The great thing about these videos, it's not just the 'how to', but also give a real example from your experience. It helps so much to make sense. Thank you so much :)
@ralu0filth
@ralu0filth 11 ай бұрын
Dude, you have a video for every question I have! Love it! Thank you, it really helps! Keep it up!
@preethimarineni
@preethimarineni Жыл бұрын
I really admire the way you define , explain tings . I feel it will be more good to ask questions at the end of explaining which helps to think more.
@snsnsn3
@snsnsn3 9 ай бұрын
The way you explain the ideas behind the scenes really makes it tangible. Thanks :)
@francksgenlecroyant
@francksgenlecroyant 3 жыл бұрын
I wish KZbin could make it possible to give a video a like any number of times i want. John is a Hero! Thanks John!
@khiemdo5527
@khiemdo5527 3 жыл бұрын
Great tutorial for Final keyword in Java. Great appreciated for the video , John. I will pass my Java interview with your videos. Happy holidays
@gema9835
@gema9835 Жыл бұрын
why do i love this guy !!! omg!!
@burgerbob7324
@burgerbob7324 2 жыл бұрын
Your channel is awesome, every video i've seen so far is succinct. This is the perfect way to refresh on Java concepts without having to waste time digging through my old courses or forums.
@sarahmahyoub5241
@sarahmahyoub5241 Жыл бұрын
I always wondered why we need to use static with final when it comes to methods. now i know! Amazing job! Subscribed already and i do that rarely!
@Rateebhatt
@Rateebhatt 8 ай бұрын
Hey can u explain why
@Clean_Slate
@Clean_Slate 2 жыл бұрын
Excellent video! Thanks for making concepts like that easy to understand while keeping the video short. I really hope your channel grows big, since I believe it deserves a lot more subs! Cheers 🍺
@jvsnyc
@jvsnyc 3 жыл бұрын
Great video. Sometimes it is reasonable to have a final instance variable, which can be initialized in its definition or in the constructor or an init block, but not later. Not as common as the examples you gave, tho.
@D_Elchapo
@D_Elchapo 9 ай бұрын
this bold man is impressive
@Anderzon1994
@Anderzon1994 3 жыл бұрын
Thanks a lot John. I've been learning many things with your videos.
@matthewbrightman3398
@matthewbrightman3398 2 жыл бұрын
I finally get it! Ura great teacher John, don’t ever change!
@teaadvice4996
@teaadvice4996 2 жыл бұрын
You're missing the static keyword video. And I need it john!!!!
@YerushalayimShelZahv
@YerushalayimShelZahv 3 жыл бұрын
John, love the videos. Thank you for making them.
@micleh
@micleh 3 жыл бұрын
As always, very helpful, comprehensive and well-explained video.
@arnavtumbde6249
@arnavtumbde6249 Жыл бұрын
Beautiful and impressive content ! So much to the point and really well explained. The most productive channel i found related to coding ! Keep it up !
@gopalkannan4934
@gopalkannan4934 Жыл бұрын
Great teacher know how to explain easy way.
@aref111
@aref111 2 жыл бұрын
Thanks a lot, you are concise and fluent I even enjoy watching your videos on topics that I already know! please keep that up.
@utkarshk2
@utkarshk2 Жыл бұрын
Your courses are great and precise and talk all concepts that need to be known . Best for quick revision. :)
@fr1ddl33
@fr1ddl33 3 жыл бұрын
You got me at "Double pie sounds really good".
@chris07ism
@chris07ism Жыл бұрын
Amazing as always. A great and concise explanation!
@kalyankumar8629
@kalyankumar8629 2 жыл бұрын
Great toutorial session! SIR.
@keyvan4680
@keyvan4680 2 жыл бұрын
Thank you very much for the clear explanation.
@smiley___face
@smiley___face 2 жыл бұрын
Finally! Ive been waiting for this video for so long 😂
@Simon6oz
@Simon6oz 2 жыл бұрын
thank you for this video. its very help full for get some knowledge
@kishoremaroju2720
@kishoremaroju2720 2 жыл бұрын
Your channel is just awesome. Can you please make a video on Java-8 time and time zones, thanks.
@desmondwhite8179
@desmondwhite8179 2 жыл бұрын
very concise explanations
@hristoplamenov1942
@hristoplamenov1942 3 жыл бұрын
John, keep going with the good explained Java videos! One hint from my side - after explaining the basics, go some levels deeper like Streams, RxJava etc.
@CodingWithJohn
@CodingWithJohn 3 жыл бұрын
We'll eventually get there I'm sure!
@hangyeollee-creuset5108
@hangyeollee-creuset5108 3 жыл бұрын
Thank you for your awesome video ! I am so glad that I found you on KZbin. I noticed that my IDE asks me to create constructors if I have final variables in the class. Ex) public class Example { private final String examples; Then I am obligated to create a constructor. But when I have just private variables in the class. IDE doesn't bother me if I create a constructor of this class or not. Is this because final variables meant to be only assigned once, this is why IDE obligates me to create a constructor of it's class ? Thank you for taking time to read my comment and have a nice day
@CodingWithJohn
@CodingWithJohn 3 жыл бұрын
Interesting question - in this case you aren't necessarily obligated to create a constructor (although much of the time this is probably what you want to do), but you are obligated to assign a value to this variable in a way that the compiler knows can only happen once, since it's final. That means you can initialize it inside of a constructor, like you're saying, with something like this: public Example (String examples) { this.examples= examples; } Or you can just initialize it right where you declare it: private final String examples = "this is the value"; These are really the only places that the compiler is able to guarantee that it's only going to be set once, so I think that's why you'll see this error. For example, if you were allowed to set this value inside some other method in your class, like: private void doStuff(){ this.example = "setting this value"; } Nothing would prevent this method from being called twice, breaking the rule that a final variable could only be set once. Even if you put it in the main() method, technically that method can be called from anywhere else in your code or even recursively (although it's really weird to do that and generally you probably shouldn't), so you still have the same potential problem.
@e10etcreature43
@e10etcreature43 2 жыл бұрын
Great Videos,Best Java Channel 🙏🔥🔥🔥🔥.
@adipurnomo5683
@adipurnomo5683 3 жыл бұрын
Simple and great explanation
@alihaydarkaya3336
@alihaydarkaya3336 2 жыл бұрын
Well done John. Thank you
@einaveldaz2700
@einaveldaz2700 Жыл бұрын
Thank you for the video. Help me so much ❤
@akvloggsofficial
@akvloggsofficial Жыл бұрын
Great , Really helpful 👏
@tahaamca2739
@tahaamca2739 3 жыл бұрын
I love your channel thank you for the best content in youtube. Also you look like Michael from Vsauce lol
@kaledbrahmi3442
@kaledbrahmi3442 3 жыл бұрын
Awesome explanation, thank you
@ff-gc3vu
@ff-gc3vu 2 жыл бұрын
Thank you, that was super clear and great 😊
@rajeshg3570
@rajeshg3570 3 жыл бұрын
Hey John, Can you please make a video on static keyword
@syarifuddinsakri7008
@syarifuddinsakri7008 Жыл бұрын
Thank you john. very helpful
@danielcarpenter5250
@danielcarpenter5250 Жыл бұрын
thanks. i really like your content.
@samkelobhongoza7994
@samkelobhongoza7994 3 жыл бұрын
Can you do Tutorial where you build a chess engine with Java, I've been searching on KZbin I can't find any and ever since I've been learning from your channel I've been improving
@farzadarian5993
@farzadarian5993 Жыл бұрын
I ❤ the way you teach
@rajeshg3570
@rajeshg3570 3 жыл бұрын
Awesome explanation.. I've a question here..in some places I've seen final parameters in a method signature. Any specific advantage for that? My guess is , if you have a final parameter in your method signature, then it won't let you assign a value inside the method body. Is that correct ?
@CodingWithJohn
@CodingWithJohn 3 жыл бұрын
Exactly right! It's a good way to guarantee that the parameter won't be reassigned throughout the execution of the method.
@andreassumerauer5028
@andreassumerauer5028 2 жыл бұрын
@@CodingWithJohn That is correct but the practise also does not make much sense IMO. While you can assign a new value to a non final parameter inside the function this will never change the variable value on the caller side outside the scope of that function. Given that the only justification for using final on a parameter is to make sure that a rookie programmer does not think he can return a value change in one of the parameters by reusing that parameter. Changing parameter values is considered bad coding style by some. To me it isn't an annoyance because I am well aware that reusing a parameter has no side effects outside the function.
@gayanjayalathbandara4604
@gayanjayalathbandara4604 2 жыл бұрын
well explained... thank you
@InterviewMindsAtWork
@InterviewMindsAtWork 7 ай бұрын
Java One Liner Code, Very Basic to know for Java programmers, kzbin.info/aero/PLUPFEhEXH0fxH8DFJJOL6RW7Og4LewPL8
@collegeStudent7373
@collegeStudent7373 Жыл бұрын
Thank you sir 😊
@showmealldblueprints
@showmealldblueprints 3 жыл бұрын
Hey John. In the case you use final in the PI variable, why would you use the static keyword too? If you can't reference anywhere else.
@adipurnomo5683
@adipurnomo5683 3 жыл бұрын
Static in variabel mean it can call without create instance class
@mrboss8790
@mrboss8790 3 жыл бұрын
Woah! this helped me!
@homelylad
@homelylad Жыл бұрын
Didn't u have to use override when you first implemented the method eat within the dog class ?
@SkyyySi
@SkyyySi Жыл бұрын
You actually SHOULD mark your classes final by default. If your class is final, you are free to unlock inheritance later on, since, before that, nothing could inherit from your class, thus all the implementation details are completely secret to consumers off it. If your class is already non-final, making it final is a backwards incompatible change.
@vedd2603
@vedd2603 3 жыл бұрын
Could you explain constructors and this operator, private variables inside class how does a programmer understand those it's like they're in different world from me
@CodingWithJohn
@CodingWithJohn 3 жыл бұрын
Constructors cannot be made final in Java, it is not allowed (wouldn't make much sense if it was allowed). I'm not sure what exactly you're asking with your other question, but I'll attempt to answer it anyway; Private variables are only visible to the class they are declared in, so you can't read or modify them from any other class. They are declared outside of any method (like PI variable we declared in this video). They can be static (not tied to any particular instance/object of the class) or non-static (each instance of the class has its own version of that variable).
@khalilbensaid9105
@khalilbensaid9105 Жыл бұрын
Hello , i want to ask you ! what is the name of theme used with your ide ! i like the combination of colors for class name methods variable etc ... thanks
@hennesseylei7398
@hennesseylei7398 Жыл бұрын
thank you for this
@scyye-gaming
@scyye-gaming 2 жыл бұрын
R.I.P technoblade
@Anic21212
@Anic21212 2 жыл бұрын
Munch Munch Munch , Nom Nom Nom 😁. Thanks for great video.
@USA-Visit
@USA-Visit 2 жыл бұрын
you the man!
@vladthe_cat
@vladthe_cat Жыл бұрын
public static final String countdown = "It's the final countdown!"
@skabbakk3184
@skabbakk3184 3 жыл бұрын
Thank you 😍
@iMmD-dy5fn
@iMmD-dy5fn 7 ай бұрын
Thanks ❤
@jakepanda209
@jakepanda209 2 жыл бұрын
Please mention what's the name of your IDE which you are writing java program... as well as theme
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
This is Eclipse, with a dark theme plugin called Darkest Dark. In newer videos I'm using IntelliJ
@irvingalejandro8303
@irvingalejandro8303 3 жыл бұрын
I love the videos
@CodingWithJohn
@CodingWithJohn 3 жыл бұрын
Thanks, and thanks for watching!
@mdanisansari6657
@mdanisansari6657 2 жыл бұрын
John, can you create a similar video for static keyword..
@fromnothingtoeverything1419
@fromnothingtoeverything1419 2 жыл бұрын
Have you done how to access private variable? In c++ we use a function to form like a bridge so to speak How do you do this in java
@suryapranesh2081
@suryapranesh2081 2 жыл бұрын
What is the difference between static method and final method because it is not possible to override both?
@yami3251
@yami3251 3 жыл бұрын
new subscriber here👋
@ananthakrishnanvs4543
@ananthakrishnanvs4543 Жыл бұрын
I have a doubt While writing a class i am intializing a private final double pi = 3.14; and when each time i am creating an instance for that class it creates memory for that variable each time why should that be done, because it is a constant keep in mind it is not declared as static
@altamashsabri8142
@altamashsabri8142 2 жыл бұрын
Thanks a lot
@FreshThanatos
@FreshThanatos 2 жыл бұрын
Just as question. The getter and setter methods could be allways final because I would like them to allways do the same right? But that would not be good practise? Or why arent they allways final when automaticly generated or why arent they allways final if people make examples? Just to safe space?
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
I could imagine a scenario where a subclass might want to implement a version of a getter or setter with other effects, so they don't have to be final by default. But if you don't want subclasses to be able to do that, final would lock that down.
@FreshThanatos
@FreshThanatos 2 жыл бұрын
@@CodingWithJohn Amazing. Thanks John. I love your work. I learn something with each of those Videos so keep it up. And thanks for answering
@MTB_Bay_Area
@MTB_Bay_Area 2 жыл бұрын
Thank you
@zimbabwe8189
@zimbabwe8189 3 жыл бұрын
I like how he looks so happy explaining it kkkkk
@3athomy1
@3athomy1 2 жыл бұрын
what about the final as a function parameter ?
@kaushalendrapandey2662
@kaushalendrapandey2662 3 жыл бұрын
Best💖
@jackofnotrades15
@jackofnotrades15 3 жыл бұрын
do one on static keyword
@rodrigoqteixeira
@rodrigoqteixeira 2 жыл бұрын
final in varibles: create constants
@stephanievulcheva8125
@stephanievulcheva8125 2 жыл бұрын
What about final instances?
@jackgame8841
@jackgame8841 Жыл бұрын
i am strruggling with it, so it is just static type checking.
@Pmc987
@Pmc987 3 жыл бұрын
It’s sad that I have over 10 years experience and understand all of your videos, from experience, but technical interviews always wash me out because I can’t remember terms during interviews
@starlinetor5791
@starlinetor5791 Жыл бұрын
so in practice final is just to prevent yourself from making mistakes laters
@ribasoul
@ribasoul Жыл бұрын
I thank you
@KeringKirwa
@KeringKirwa Жыл бұрын
am still struggling with the real world user case of this final thing !
@selvaperumal100
@selvaperumal100 Жыл бұрын
Which ide is this sir
@DistrectionUsonov
@DistrectionUsonov Ай бұрын
Eclipse
@alinadeem8947
@alinadeem8947 2 жыл бұрын
Someone can still remove the final keyword from Pi and overwrite it isnt it? WHats the point here just trying to understand
@mr.dingleberry4882
@mr.dingleberry4882 2 жыл бұрын
Its to prevent accidental reassignment. If someone goes out of their way to edit out the final keyword, then that was very much not accidental.
@dilln2158
@dilln2158 3 жыл бұрын
I just found your LinkedIn, 3.95 GPA... This man fucks! What's your advice for CS students trying to achieve a high GPA? Also how important would say GPA is when applying for your first full-time position? I'm going into my sophomore year with a 3.8 GPA.
@CodingWithJohn
@CodingWithJohn 3 жыл бұрын
Yeesh, guess I might be easier to find than I thought..... A good GPA is nice to have and might break a tie with another job candidate but it's not the be-all-end-all. If it's real bad you'll probably have a tough time finding a first gig, but after that no one will ask. As for getting a high GPA - don't take Russian Literature. Start your programming assignments early. Computer lab time with other students and tutors can help at lot and you'll absorb a ton watching how other people do things, and is usually just more fun than staying in your room anyway.
@dilln2158
@dilln2158 3 жыл бұрын
@@CodingWithJohn Thanks!
@ishuuuuuuuuuuuuuu
@ishuuuuuuuuuuuuuu 4 ай бұрын
🔥🔥
@abMovieCutts
@abMovieCutts 2 жыл бұрын
for his video 0.5x is necessary
@tito6121
@tito6121 2 жыл бұрын
watched
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
Responded
@tuba9800-m4s
@tuba9800-m4s Жыл бұрын
2.07
@hedgehog337
@hedgehog337 6 ай бұрын
rainbow like button.........
@CodingWithJohn
@CodingWithJohn 6 ай бұрын
😐
@hedgehog337
@hedgehog337 6 ай бұрын
@@CodingWithJohn ? I just haven't seen it before so it was impressive
@hedgehog337
@hedgehog337 6 ай бұрын
@@CodingWithJohn i didn't understand why you put "😐" 😕
@jeanehu-pludain6640
@jeanehu-pludain6640 2 жыл бұрын
final class is bad
Java File Input/Output - It's Way Easier Than You Think
8:18
Coding with John
Рет қаралды 508 М.
Super Keyword in Java Full Tutorial - How to Use "super"
11:33
Coding with John
Рет қаралды 222 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
Static vs Non-Static Variables and Methods In Java - Full Simple Tutorial
11:29
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 847 М.
Java's Creators Rejected Multiple Inheritance - Here's Why
13:14
Coding with John
Рет қаралды 71 М.
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 163 М.
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 573 М.
Generics In Java - Full Simple Tutorial
17:34
Coding with John
Рет қаралды 1,1 МЛН
Optionals In Java - Simple Tutorial
15:53
Coding with John
Рет қаралды 225 М.
Java static keyword ⚡
8:18
Bro Code
Рет қаралды 125 М.
Map and HashMap in Java - Full Tutorial
10:10
Coding with John
Рет қаралды 622 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН