Java toString method 🎉
HTML-код
- Опубликовано: 5 авг 2024
- Java toString method tutorial explained
#Java #toString #method #tutorial #explained
//*****************************************
public class Main {
public static void main(String[] args) {
// toString() = special method that all objects inherit,
// that returns a string that "textually represents" an object.
// can be used both implicitly and explicitly
Car car = new Car();
System.out.println(car.toString());
// or
System.out.println(car);
}
}
//*****************************************
public class Car {
String make = "Ford";
String model = "Mustang";
String color = "red";
int year = 2021;
public String toString() {
return make +"
"+model+"
"+color+"
"+year;
}
}
//***************************************** Наука
//*****************************************
public class Main {
public static void main(String[] args) {
// toString() = special method that all objects inherit,
// that returns a string that "textually represents" an object.
// can be used both implicitly and explicitly
Car car = new Car();
System.out.println(car.toString());
// or
System.out.println(car);
}
}
//*****************************************
public class Car {
String make = "Ford";
String model = "Mustang";
String color = "red";
int year = 2021;
public String toString() {
return make +"
"+model+"
"+color+"
"+year;
}
}
//*****************************************
you dont sound like a Bro
🇿🇦 South African junior Software developers thank you for your service. I have made over 200slides and counting of your full tutorial. You're better than my lecturers.
Awesome video, understood clearly
Thanks bro Code
Very simple, right to the point, clear, no useless blabla.. great video. Thank you so much
I love this comment too!
Best explanation i've come across, thanks!!
Well explained, mate! The info that toString() is called each time you use println to display an object, without the need of writing it down, was my gold nugget in this video!
Thanks for that and keep on!
Your way to explain is the best🙃thanks!
If you're ever struggling with Java in school, just come to this channel and follow this man's video. You're going to understand the materials so much better and possibly make it into development
This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
Bro I'm reviewing basic stuffs cuz I tend to forget and I just wanna say that you're a godsent to this world. Keep it up man!
loving the java because of this series of tutorial
Great stuff, thank you
clear and focused, great work Bro!
This channel is incredible!
Great job!
One time i had a mistake when i saw the 82'th clip in ur list, and then, i realized and watched again at the first video, i easily to understand. That's a amazing :D Thanks guy for sharing
I finally get it lol thanks you have the best explanations I am glad I found your channel!
Fantastic! Thank you!!
simple explanation thank you a lot
Thanks, Bro! ☕ You're awesome!
Awesome tutorial!
great video very helpful!!
Shit dude I just discovered your channel and it is sooo helpful (I like how you explain stuff simply and make it easy to understand) . Keep helping people like this and I'm sure your channel will grow (you definetly deserve more than 5K subscribers)
thanks Ruben!
lol he had 5K suscribers 1 year ago? Definitely he grew up! ^^
lol now he has 600k!
@@gaminggoddessaria Well he now has 1 MILLION !
And now there are 1.5 million subscribers.
It took 1 hour to explain this in lectures.still did not get it. Bro explained it perfectly in 6 mins. God bless you bro
I like your explanation bruh i think You're The best Teaching I've Ever Seen
Great explanation bro, thank you
the best java free course available greet work broCode
Owesome bro i always love your videos
crystal clear, Thanks Bro
good teach!thanks bro
Thank you very much !!
Thank you!
Great *Bro code*
i am going to download your all java playlist
great explanation
and thank you *Bro* 👍👍👍
sweeeeet! Thanks for watching Muhammad!
Great Video!
Thanks!
Thanks, bro.
Man you're the best!!!!
this was explained so well! thanks bro, ima fellow bro now ;D
You are the best thank you♥️
Thank you bro!💛
Thank you.
thank you !!
Thanks 👍😊 bro you are living legend
Thank you so much sir.
I love you BRO!!!! From Russia with LOVE!!!!
thank you bro
You are a legend man
Thank you! From Ukraine.
Thnks senpaii
Nice!!!
nice video, much better than my lecturer did
You're the BEST 😉
thank you my Bro ♥♥♥
Thanks :)
Well explained Bro!
thank you.
thx bro
bro @ 1:53 i typed sysout(pizza) from the overloaded constructor lesson and came with similar answer I was like "java shouldve created a code for easier access" , and behold the answer to that problem is this lesson lmao, I like your tutorials bro have a nice day!
Thanks broseph
ur the best
Thank u bro
Damn! I better understand your tutorials than yt tutorials in my native language. Thank you, great job:)
Yes, it's true.
This is something new
Ok, so we can use toString implicitly, without using "make, model, color so on" manually. Completely understood. 30th. Thank you, ma Bro Sensei!
Cool :)
great videos
Best bro!!!!
30th. Thank you, ma Bro Sensei
wonderful
goooooooooood work bro thx
Thanks
Great❤
Nice.
i lov u bro
Pure bliss
Ayo, I'm passing Java, thanks!
ty
Awesome
Perfect
thanks
Gratitude from Lithuania
Dropping a comment :]
nice work
really nice
my appreciation
Makes sense
Nice Explanation sir
very good🎉🎉🎉🎉🎉
great
👍
very good
best bro
Great
Nice
nice
a usual w from the Bro Code
🥰
😘😍😻
coool
Dang I can’t be the only one that’s been calling my objects variables by print lines this entire time 😂 I feel silly now