No video

Java printf 🖨️

  Рет қаралды 115,325

Bro Code

Bro Code

Күн бұрын

Java printf method tutorial explained
#java #printf #format

Пікірлер: 147
@BroCodez
@BroCodez 3 жыл бұрын
public class Main { public static void main(String[] args) { // printf() = an optional method to control, format, and display text to the console window // two arguments = format string + (object/variable/value) // % [flags] [precision] [width] [conversion-character] boolean myBoolean = true; char myChar = '@'; String myString = "Bro"; int myInt = 50; double myDouble = 1000; // [conversion-character] //System.out.printf("%b",myBoolean); //System.out.printf("%c",myChar); //System.out.printf("%s",myString); //System.out.printf("%d",myInt); //System.out.printf("%f",myDouble); //[width] // minimum number of characters to be written as output //System.out.printf("Hello %10s",myString); //[precision] // sets number of digits of precision when outputting floating-point values //System.out.printf("You have this much money %.1f",myDouble); // [flags] // adds an effect to output based on the flag added to format specifier // - : left-justify // + : output a plus ( + ) or minus ( - ) sign for a numeric value // 0 : numeric values are zero-padded // , : comma grouping separator if numbers > 1000 //System.out.printf("You have this much money %,f",myDouble); } }
@user-gg1wc7ki7z
@user-gg1wc7ki7z 3 ай бұрын
Well explained bro thanks am going to smash my test today
@thechrome1893
@thechrome1893 3 жыл бұрын
I can't imagine myself learning this all alone. you are making the work smoother for me. good effort bro, keep it up!
@ctluwua7695
@ctluwua7695 3 жыл бұрын
For me also BRO
@TuxTuxedo-oc9kg
@TuxTuxedo-oc9kg Жыл бұрын
I think I know all of your java videos lol. Thanks a lot. A note I wanted to add for other viewers: printf does not automatically go to the next line, similar to System.out.print(); for that, include a " " in the printf statement like this: Example: double aDouble = 5.5555; System.out.printf("%.1f ", aDouble); this prints the value "5.5" and goes to the next line just like System.out.println(5.5); would do. I state this because if you printf twice in a row with double or float values and do not include the " " then you may go crazy looking for the error because you will get something like this: Example: double a = 5.1211 double b = 4.4511 System.out.printf("%.2f", a); System.out.printf("%.2f", b); The output would be: 5.124.45 since there is no " " included, 4.45 will simply be appended to 5.12 -> 5.124.45 adding " " prevents this from happening: System.out.printf("%.2f ", a); System.out.printf("%.2f ", b); output: 5.12 4.45 Cheers
@tahaberkkotan4152
@tahaberkkotan4152 5 ай бұрын
thx bro
@SimpleAverageBoi69
@SimpleAverageBoi69 3 ай бұрын
useful to know arigato :3
@piano-ii1ii
@piano-ii1ii 2 ай бұрын
Forward slash
@aerobiesizer3968
@aerobiesizer3968 Жыл бұрын
This taught me printf better in 11 minutes than my college professor or textbook did in 3 months. Thank you
@nickgavrilis2079
@nickgavrilis2079 Жыл бұрын
Dude same! Why do professors overly complicate java so much
@andiuptown1711
@andiuptown1711 11 ай бұрын
@@nickgavrilis2079Learning I/O streams 😢
@jazimjazz6928
@jazimjazz6928 3 жыл бұрын
System.out.println(" 100% Better than paid online classes");
@sauv1k
@sauv1k 3 жыл бұрын
System.out.printf("%d Better than Paid Online Classes!", 100);
@elionayzuridasilveira4140
@elionayzuridasilveira4140 4 ай бұрын
boolean thisStatement = true;
@paolobonsignore2813
@paolobonsignore2813 3 жыл бұрын
you're even better than any of my professors at college.
@harshithakeshav1199
@harshithakeshav1199 3 жыл бұрын
This video helped me understand the printf() method better. Thank you. Keep up the good work !!
@official-DRFRE
@official-DRFRE 2 жыл бұрын
I love the way you explain everything it's quick precise and clear.... I love it!
@flipped-tortoise
@flipped-tortoise 3 жыл бұрын
tbh didnt need this info rn, but after watching a few of your vids your explanations are very clear and precise! thats a sub for me
@nova3227
@nova3227 2 жыл бұрын
Thanks brocode, you are going to be helpful to a lot of software engineers
@mohammadreza1414
@mohammadreza1414 Ай бұрын
Considering how much headache you have saved us from, you are definitely going to heaven.
@pavelkvasnicka6856
@pavelkvasnicka6856 Жыл бұрын
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
@omersond4891
@omersond4891 3 жыл бұрын
you are one of the best java teacher
@JuliHoffman
@JuliHoffman 2 жыл бұрын
This would have helped me earlier this week! Need to watch more videos.
@BakhtimurodPrimov
@BakhtimurodPrimov Жыл бұрын
can't believe such good resources are available for free
@BakchodMaafia
@BakchodMaafia Жыл бұрын
i really appreciate your assistance brother .God bless you
@miladysperez2043
@miladysperez2043 10 ай бұрын
dude i was having such a hard time understanding thank you so much !
@jancsovicsmark3409
@jancsovicsmark3409 2 жыл бұрын
Bro, I'm very appreciative of your help.
@seanvinluan7562
@seanvinluan7562 2 жыл бұрын
Yow bro, thank for this tutorials men. It means a lot to me I learned a lot from your videos men, KEEP IT UP BRO!!
@bacon5481
@bacon5481 Жыл бұрын
Amazing video, so easy to follow, goated bro.
@danny.3036
@danny.3036 3 жыл бұрын
Thanks, Bro! ☕ You're awesome!
@soumelee5661
@soumelee5661 Жыл бұрын
good topic. i had no idea, printf exists in java too
@eragondrache6891
@eragondrache6891 Ай бұрын
Good Turotial
@dannyblanco8544
@dannyblanco8544 Жыл бұрын
I just really want to thank you😭! I needed to make my float to only have 4 decimals
@automanautomation9845
@automanautomation9845 3 жыл бұрын
Thank you man, very clear video.
@mohamedelfadli3125
@mohamedelfadli3125 Жыл бұрын
Thanks for the great effort.
@wewonbro1620
@wewonbro1620 3 жыл бұрын
Bro Code really do be feeling like my Bro for code
@ottttoooo
@ottttoooo 3 жыл бұрын
bro? 😳
@spooky_zn6
@spooky_zn6 3 ай бұрын
great work bro
@vanessasantiago2666
@vanessasantiago2666 2 жыл бұрын
This is so very helpful! Thank you so much!
@TheSovietGuy
@TheSovietGuy 10 ай бұрын
very godd videos sir open your branch in india
@moham129
@moham129 2 жыл бұрын
Thank for the amazing video
@shivambajpai3368
@shivambajpai3368 Жыл бұрын
Thanks so much man, really helped me
@anuragsen3694
@anuragsen3694 2 жыл бұрын
your videos are very helpfull
@Qmohd1
@Qmohd1 2 жыл бұрын
Honestly, better than my teacher
@faintedkid6745
@faintedkid6745 2 жыл бұрын
thank you, i was struggling earlier
@ardcodelover
@ardcodelover Жыл бұрын
Very nice sir
@ashutoshswain4050
@ashutoshswain4050 2 жыл бұрын
awesome teaching brother :)
@user-zq6yx7of5f
@user-zq6yx7of5f Жыл бұрын
thank you very much
@ctluwua7695
@ctluwua7695 3 жыл бұрын
When I Watch his videos I Always Think , When I'll be An Software Engineer , I'll Give 50% Credit to BRO 'Cause He helped me a Lot . Much Better than my Damn school.
@ThomasTheThermonuclearBomb
@ThomasTheThermonuclearBomb 2 жыл бұрын
Please don’t capitalize every word in your sentence. I had a stroke reading that
@misterwiggles8771
@misterwiggles8771 Жыл бұрын
Why does he not explain the "%020f" part for when you do a lower number than 20? For me it started with 3 zeros at "%015f" then added zeros up to 8 at 20. I don't know if it's really that important in the grand scheme of things, but it definitely through me for a loop trying to understand that part.
@dimitrie17
@dimitrie17 3 жыл бұрын
Great explanation! Keep it up!
@zarrinnahid448
@zarrinnahid448 2 жыл бұрын
Damn! You are soo good :0
@TranLinh-iy9zy
@TranLinh-iy9zy Жыл бұрын
Thank you so much ❤
@fei4009
@fei4009 8 ай бұрын
thank you so much!!
@kaiiemsawat3859
@kaiiemsawat3859 3 жыл бұрын
Thank you, Bro I wonder how do I do if I want to add .2 as precision and 20 in width in the same time. It doesn't work when I tried it.
@heyou1158
@heyou1158 2 жыл бұрын
% [flags] [width] [precision] [conversion-character] i think that is the right sequence because I had the same question. So: double myDouble = 1000; System.out.printf("%,20.2f",myDouble); //that should do the trick
@leticiamartinezgarcia1267
@leticiamartinezgarcia1267 2 жыл бұрын
You saved my day
@mukandeinc
@mukandeinc Жыл бұрын
Thanks so much bro
@percivalgebashe4376
@percivalgebashe4376 Жыл бұрын
Nice
@aadityapanchal8551
@aadityapanchal8551 Жыл бұрын
Thanks sir
@w3jd4n
@w3jd4n Жыл бұрын
weirdly enough, in my courses' labs we needed formatting yet we've never been taught it
@ImranPanhwar-kf3rt
@ImranPanhwar-kf3rt 11 ай бұрын
nice
@TheEvertonDias
@TheEvertonDias Жыл бұрын
Thanks, Bro!
@gustavobastosbarbosa1391
@gustavobastosbarbosa1391 2 ай бұрын
thanks bro
@zainrajab648
@zainrajab648 10 ай бұрын
Whenever I write printf and print int with a phrase using %d it doesn't work. It works only with char and String, not with number: double, float, int. Can anyone tell me what to do?
@spacebarium
@spacebarium 8 ай бұрын
Showing example code would be helpful
@bekturasanbekov1979
@bekturasanbekov1979 Жыл бұрын
thx 4 vid bro !
@maziarheidari9797
@maziarheidari9797 Жыл бұрын
Thanks bro
@huuloc8719
@huuloc8719 2 жыл бұрын
NIce.
@TWVVermin
@TWVVermin 2 жыл бұрын
thank you,.
@user-qw6dy5tg8j
@user-qw6dy5tg8j 10 ай бұрын
Thanks
@Snowmanver2
@Snowmanver2 3 жыл бұрын
Great video
@janajanhajsu4998
@janajanhajsu4998 Жыл бұрын
Bro is a pro
@Joshua_t_
@Joshua_t_ 2 жыл бұрын
nicely explained
@sailorsaturn4693
@sailorsaturn4693 Жыл бұрын
Thanks King
@cesara9747
@cesara9747 2 жыл бұрын
beast mode!
@UmeshKumar-zh8wk
@UmeshKumar-zh8wk 3 жыл бұрын
Osm Bro 🔥🔥🔥 Thank U
@skeletalcrib377
@skeletalcrib377 11 ай бұрын
thanks
@wolanus
@wolanus 3 жыл бұрын
Great video!
@minhtetpaing1695
@minhtetpaing1695 3 жыл бұрын
Thank you sir.
@sairos4057
@sairos4057 Жыл бұрын
thanks bro!
@shitchest
@shitchest 2 жыл бұрын
this helped alot
@anandomia3161
@anandomia3161 3 жыл бұрын
Awesome
@chaithdridi2718
@chaithdridi2718 3 жыл бұрын
You are doing an amazing job Bro 😍
@ghoggaliabdou4222
@ghoggaliabdou4222 3 жыл бұрын
Thank you.
@Supertramp133
@Supertramp133 2 жыл бұрын
Thank you!
@Supertramp133
@Supertramp133 2 жыл бұрын
Bro
@muskastanikzai1708
@muskastanikzai1708 2 жыл бұрын
love u bro
@alialhussain4139
@alialhussain4139 2 ай бұрын
Thanks, Bro 06/03/2024
@rico.levitt7
@rico.levitt7 3 жыл бұрын
thank you bro :)
@V_Smah
@V_Smah 3 жыл бұрын
thanks a lot!!!
@pa-305
@pa-305 3 жыл бұрын
best bro
@aripasternak3305
@aripasternak3305 Жыл бұрын
thx bro
@nikitassouvatzis1928
@nikitassouvatzis1928 Жыл бұрын
Η συγκεκριμένη μέθοδος printf() υπάρχει και στη γλώσσα προγραμματισμού C.
@fredericoamigo
@fredericoamigo 2 жыл бұрын
So… kind of like a f-string in python. Nice Bro!
@sriramn1809
@sriramn1809 3 жыл бұрын
Is there a way to set the [width] in the string formatting to a variable that can be input from the user?
@immortalbotyt1428
@immortalbotyt1428 3 жыл бұрын
ya !
@revolutionaryfrog
@revolutionaryfrog 2 жыл бұрын
so this just makes it so i dont have to create and import DecimalFormat DF = new DecimalFormat for double outputs, i should just use printf for any formatting?
@zukisamaliwa7668
@zukisamaliwa7668 3 жыл бұрын
How do you put a zero in front of an integer?
@abdulbasit0123
@abdulbasit0123 2 жыл бұрын
thanks bro🤍
@shalajko
@shalajko 3 жыл бұрын
some food for the allmighty algorithm : "great , concise, high quality, .addrandomAdjective(); "
@maksimush1928
@maksimush1928 3 жыл бұрын
Hi from Ukraine!! U cool man
@BroCodez
@BroCodez 3 жыл бұрын
thanks Maksi!
@augischadiegils.5109
@augischadiegils.5109 3 жыл бұрын
Thanks!!
@greeneggsandmushrooms9855
@greeneggsandmushrooms9855 3 жыл бұрын
was this for matt?
@zarmmraz5267
@zarmmraz5267 3 жыл бұрын
Why it is not using %I for integer. I thought it was %I but it was %d. It's quite confusing.
@_Anna_Nass_
@_Anna_Nass_ 2 жыл бұрын
Probably a carryover from the C language. Many high level languages are written in/based off C.
@straightcable1836
@straightcable1836 2 жыл бұрын
Can i ask why it's not working on me?
@medjl6083
@medjl6083 3 жыл бұрын
formatting method
@lilhose2597
@lilhose2597 Жыл бұрын
W
@aiueo8962
@aiueo8962 Жыл бұрын
gg bang
@beckhamwilson2112
@beckhamwilson2112 Жыл бұрын
woooo code
@dasunprabashana2554
@dasunprabashana2554 2 жыл бұрын
printf is already available in C++
@liliacfury
@liliacfury 3 жыл бұрын
Comment for youtube algorithm :)
@anjapietralla5767
@anjapietralla5767 7 ай бұрын
😀
@alexyakoveno4682
@alexyakoveno4682 2 жыл бұрын
Java final keyword ⛔
2:35
Bro Code
Рет қаралды 44 М.
Java objects (OOP) ☕
10:46
Bro Code
Рет қаралды 167 М.
Little brothers couldn't stay calm when they noticed a bin lorry #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 21 МЛН
SPILLED CHOCKY MILK PRANK ON BROTHER 😂 #shorts
00:12
Savage Vlogs
Рет қаралды 50 МЛН
PEDRO PEDRO INSIDEOUT
00:10
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 18 МЛН
Java methods 📞
11:05
Bro Code
Рет қаралды 129 М.
Println vs Print vs Printf in Java
20:49
Engineering Digest
Рет қаралды 1,4 М.
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 518 М.
Java HashMap 🗺️
13:05
Bro Code
Рет қаралды 81 М.
Java serialization 🥣
21:13
Bro Code
Рет қаралды 74 М.
Learn web development as an absolute beginner
12:57
Coder Coder
Рет қаралды 2,9 МЛН
Learn Java in 14 Minutes (seriously)
14:00
Alex Lee
Рет қаралды 4,7 МЛН
Java dynamic polymorphism ✨
8:52
Bro Code
Рет қаралды 67 М.
Java wrapper classes 🎁
7:13
Bro Code
Рет қаралды 109 М.
Little brothers couldn't stay calm when they noticed a bin lorry #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 21 МЛН