In Some Tutorials While We Are Using Classes, Methods, Constructors And All These Stuff, Sometimes We Use The String Format And Sometimes We Don't. And I Don't Get It When Do We Actually Need To Use It And When We don't Need to ?
QUESTION= You say FINAL can not change anywhere! But if you make a new Object lets say tuna tunaObject2 = new tuna(15); then final is gonna be 15 after this point in tunaObject2 right!!! So actually I could change it some how or?
There is a mistake here. NUMBER is not visible cuz it's declared as private. Change it to public then u will see the right error message about changing its value.
i did a never ending-loop by accidnet cuz in the for loop i had put: for(int i=0;1<5;i++) did you see the mistake? i put "1<5" instead of "i<5" im already at sum = 5 billion
I changed private final NUMBER to public final NUMBER.. the error message is the field tuna.NUMBER cannot be assigned.. yeah, u can't change a 'final'.
Just throwing this out there, but I'm a comp sci major in college and your tutorials from like 46 – 55 were super helpful in explaining some of these java concepts. So thanks a lot man and good shit
Though he explained the theory correct, his code doesn't really explain the significance of final. For better understanding try this : package sachin;
public class Ocean { public final int salmon;
public Ocean(){ salmon =1; } public void setFish(int x) { this.salmon = x;//this will throw an error that final field Ocean.salmon can't be assigned. } } Error is thrown in the set method but not in constructor because compiler knows that a constructor can be invoked once per object but the method can be called multiple times.
We lost a lot of people after that difficulty spike 0-0
In Some Tutorials While We Are Using Classes, Methods, Constructors And All These Stuff, Sometimes We Use The String Format And Sometimes We Don't. And I Don't Get It When Do We Actually Need To Use It And When We don't Need to ?
Can somebody tell me the concept of to string
1:55 so like marriage?
Nice joke you "fish" 😀
Am i too late for the fantasy football?
why wouldn't you just make every variable public? why make it private?
Finally i got here
why the original sum=0?
Is it too late to get in on that fantasy football action?
Hi. How do the sums being displayed out by writing System.out.printf("%s", tunaObject); ?
QUESTION= You say FINAL can not change anywhere! But if you make a new Object lets say tuna tunaObject2 = new tuna(15); then final is gonna be 15 after this point in tunaObject2 right!!! So actually I could change it some how or?
fantasy football?
There is a mistake here. NUMBER is not visible cuz it's declared as private. Change it to public then u will see the right error message about changing its value.
hello, how is about fantasy football?
I have learnt many syntax of Java, God to give all the best for your work. You are my teacher.
You still up for fantasy football?
Im assuming it might be too late to join bucky in FF.
9 years later and its still 2 🙁
You did not give sum an initial value as 0 why did the computer assume sum to be 0?
i did a never ending-loop by accidnet cuz in the for loop i had put:
for(int i=0;1<5;i++)
did you see the mistake?
i put "1<5" instead of "i<5"
im already at sum = 5 billion
very nicely explained tutorial <3
The constants are in CAPS… K..K..K.
K..K, that's how you can remember it xD
it has to be fish or this program won't work.
😆😆 Savage Leval 99.999% 😆😆
Lol, this error when it says field not visible isn't because of the final, it’s because NUMBER Is a private variable…
I changed private final NUMBER to public final NUMBER.. the error message is the field tuna.NUMBER cannot be assigned.. yeah, u can't change a 'final'.
Just throwing this out there, but I'm a comp sci major in college and your tutorials from like 46 – 55 were super helpful in explaining some of these java concepts. So thanks a lot man and good shit
number is private thats why it is not visible, not because it is final
Though he explained the theory correct, his code doesn't really explain the significance of final.
For better understanding try this :
package sachin;
public class Ocean {
public final int salmon;
public Ocean(){
salmon =1;
}
public void setFish(int x) {
this.salmon = x;//this will throw an error that final field Ocean.salmon can't be assigned.
}
}
Error is thrown in the set method but not in constructor because compiler knows that a constructor can be invoked once per object but the method can be called multiple times.