How to accept user input in Java ⌨️【8 minutes】

  Рет қаралды 179,581

Bro Code

Bro Code

3 жыл бұрын

Java user input scanner
#Java #input #scanner
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("What is your name? ");
String name = scanner.nextLine();
System.out.println("How old are you? ");
int age = scanner.nextInt();
scanner.nextLine();
System.out.println("What is your favorite food?");
String food = scanner.nextLine();
System.out.println("Hello "+name);
System.out.println("You are "+age+" years old");
System.out.println("You like "+food);
}
}

Пікірлер: 246
@simrangill5830
@simrangill5830 3 жыл бұрын
You are the best teacher ever
@doronfeldman5152
@doronfeldman5152 6 ай бұрын
Agree
@BroCodez
@BroCodez 3 жыл бұрын
// It's good practice to close your scanner when you are done using it. scanner.close(); // I forgot to. So I didn't import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("What is your name? "); String name = scanner.nextLine(); System.out.println("How old are you? "); int age = scanner.nextInt(); scanner.nextLine(); System.out.println("What is your favorite food?"); String food = scanner.nextLine(); System.out.println("Hello "+name); System.out.println("You are "+age+" years old"); System.out.println("You like "+food); scanner.close(); } }
@nairaac
@nairaac 3 жыл бұрын
thanks for giving it in the comments! also mine kept on saying error on the first line.
@CS_CHILD
@CS_CHILD 6 ай бұрын
Umm....I'm having a problem here please It says error..system cannot be resolved to a variable
@davidbolduc4378
@davidbolduc4378 3 жыл бұрын
This channel is the best thing to happen to my GPA since Chegg
@pastel1213
@pastel1213 3 жыл бұрын
This is incredible bro, can't believe that not a lot of people watch this. That is the way to teach people! Keep it up! Love your videos
@meng-junglee9071
@meng-junglee9071 2 жыл бұрын
Bro you have no idea how long it took me to wonder why I couldn't enter any input with the nextLine after nextInt. You are awesome!!
@JuliHoffman
@JuliHoffman 2 жыл бұрын
That broke down the WHY of scanners for me, rather than "because that's just the way it is." Thank you!
@Elvin-ne6qq
@Elvin-ne6qq 9 ай бұрын
I just discovered your channel, your way of explaining things without too much fuss and in an easy way is amazing, greetings from Honduras and thanks a lot👻.
@mailiesathare
@mailiesathare 2 жыл бұрын
I like how you tackled the newline character stuck in the buffer integrated concept (I would still call it an error). I was taught that the buffer needed to be cleared, and I still do not know how to visualize a buffer.
@1jokerpro780
@1jokerpro780 3 жыл бұрын
for strings , when using scanner , its better to use .next(); instead of .nextLine(); to avoid that error , that worked for me at least . and i have to say , great video , thanks for the efforts . this is by far the most beginner friendly , right to the point , including tricks and errors tutorial. i sincerely thank you bro hahahaha
@stephaniehernandez3641
@stephaniehernandez3641 2 жыл бұрын
Thank you!!! I took a note of this :)
@paia6447
@paia6447 2 жыл бұрын
Next() keyword won't be able to print the whole text, for like name and tittle at the same time
@ayansiddiqui7383
@ayansiddiqui7383 2 жыл бұрын
Thanks , it helped a lot
@cubebrick7019
@cubebrick7019 2 жыл бұрын
helped me thanks
@sairos4057
@sairos4057 2 жыл бұрын
If you use ".next();" instead of ".nextLine();", It will be not possible to type more than one word Example: Joker - works fine Joker pro - error
@unalysuf
@unalysuf Жыл бұрын
Your explanations and examples is very clean and easy to learn. Thank you so much for your effort
@SwatiKumari-pl7dg
@SwatiKumari-pl7dg 10 ай бұрын
Sir,u really explained Java much more better than the others ,its really commendable.This is the only channel which explains Java in good ways ,i m from India, big thanks to you
@danrobinlibunao4475
@danrobinlibunao4475 2 жыл бұрын
eyyy new bro here, I had been dealing with a lot of difficulties on understanding Java and thanks to you it gave me a on point lesson to different difficulties. Keep it up bro I know that you can help more beginner like me.
@sarthak3401
@sarthak3401 7 ай бұрын
Just started this course...super excited to finish it ❤😊
@deepthakur14916
@deepthakur14916 Жыл бұрын
Using this series alongside with my uni course , love u bro 👊
@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
@cristalpineda4178
@cristalpineda4178 2 жыл бұрын
May God bless you, its has been hard since I started college. Now I can Understand better!!!
@Error77_
@Error77_ 5 ай бұрын
Best teacher for beginners and intermediate 🎉🎉🎉
@muzzammilsabuwala2398
@muzzammilsabuwala2398 Жыл бұрын
Bro really you made it so easy for me Thanks a lot for that bro Whenever I get stuck I come to your channel and as always I return with a great happy feeling and also with understanding the concept ❤❤❤❤❤❤❤❤❤❤❤❤❤❤
@ratnaverma2661
@ratnaverma2661 Жыл бұрын
Hey Bro! I am from India and only your tutorials helped me learn programming even my main language didn't help, Thanks a lot, I am a kid btw
@LincyMcGabby
@LincyMcGabby 4 ай бұрын
You made it so simple & super easy to understand. Thank you
@ilgarvideographer
@ilgarvideographer Жыл бұрын
Short ☑️ Useful ☑️ Practical ☑️ Life Changing ☑️
@ajaydalvi1378
@ajaydalvi1378 Жыл бұрын
Thanks, Bro!! /n explanation was what I was looking for throughout the youtube
@alexandrulolea4631
@alexandrulolea4631 Жыл бұрын
Thank you for the great video! Keep up the good work!
@zxnnightstalker2289
@zxnnightstalker2289 3 жыл бұрын
I hope you will get more than 1M views each time you uploaded a new video after one day, in the future.
@bahaamalaeb5138
@bahaamalaeb5138 3 ай бұрын
if this guy isn't the best teacher in the world idk who is LOVE YOU BRO
@user-ss3dj3hl1x
@user-ss3dj3hl1x 5 ай бұрын
Man! You saved my java project! Thank you!
@stanislawunruh9082
@stanislawunruh9082 2 жыл бұрын
Love your style bro!
@anamika_deb
@anamika_deb 3 жыл бұрын
Finally, get this tutorial that explained this error clearly
@doronfeldman5152
@doronfeldman5152 6 ай бұрын
You are the best programming channel!
@RandomUser_543
@RandomUser_543 2 жыл бұрын
your videos are so useful, thank you
@calm_bloomer1219
@calm_bloomer1219 Ай бұрын
Thank you for giving us such a great learning material !:)
@marcinzale
@marcinzale 3 жыл бұрын
Great tutorial! Thanks!
@viperproduction6454
@viperproduction6454 3 жыл бұрын
Nice and smoothly explained
@venkat2217
@venkat2217 2 жыл бұрын
Excellent Bro ♥️ , You've earned a couple of subscribers!
@user-rs2ks1pb1s
@user-rs2ks1pb1s Жыл бұрын
Great explanation of the mysterious behavior of the Scanner class.
@joshuaasukwo
@joshuaasukwo 8 ай бұрын
For the first time my code executes without error!! # Thank you so much sir, I love your pattern of writing codes so simple ...
@medjl6083
@medjl6083 3 жыл бұрын
Very important video of Java for input data by user with keyboard.
@ihssanenedjaoui1444
@ihssanenedjaoui1444 5 ай бұрын
your videos ara just incredible
@eboylydz1148
@eboylydz1148 2 жыл бұрын
this is a comprehensive explanation
@SirKingCAT
@SirKingCAT Жыл бұрын
Very easy to understand. Thank you :)
@alifaizi6996
@alifaizi6996 2 жыл бұрын
You are simply great, Bro!
@alexeybudkovskiy
@alexeybudkovskiy Жыл бұрын
Thanks Bro for a great lesson!
@souleaterboss2246
@souleaterboss2246 Ай бұрын
a perfect reviewr ty my dude
@thelastmuslimsamurai3109
@thelastmuslimsamurai3109 2 жыл бұрын
Bro is always here for me. Thank you Bro ❤️❤️❤️
@thisisbrewsworld
@thisisbrewsworld 2 жыл бұрын
You are amazing bro. Thank you so much
@wallstreetbets7741
@wallstreetbets7741 2 жыл бұрын
thank for teaching. I learnt from you
@suleimandiveriosallum3756
@suleimandiveriosallum3756 3 жыл бұрын
Jesus, you are the best man! I discover your channel today!
@likeafallen2620
@likeafallen2620 10 ай бұрын
Super as usually!!
@dogowo
@dogowo 2 жыл бұрын
incredible video, thank you bro
@jesterfield5034
@jesterfield5034 3 ай бұрын
Thank you so much for this playlist! I'm currently reviewing for our Algorithms class, bro and I totally forgot about it all 😭😭😭
@bobfarker4001
@bobfarker4001 Жыл бұрын
The shia Labeouf "Just do it" icon made me subscribe. Thanks bro
@joshbenjamin1100
@joshbenjamin1100 Жыл бұрын
Great video! One question. I made a program that has an IF/ELSE statement in it, so depending on the user's input of age, it goes to one or the other. The program continues to ask questions and receive input if the user's input leads to the ELSE statement, but if it leads to the IF (i.e., the statement before the ELSE) statement, it stops taking input. Any idea why?
@fizykanaty1346
@fizykanaty1346 Жыл бұрын
Great video , thanks for the efforts !!!
@pushankarmakar1783
@pushankarmakar1783 Жыл бұрын
best java course!
@animeforever8508
@animeforever8508 10 ай бұрын
This is epiccccccccccccccccccccccc loving this.............
@ryannayak5797
@ryannayak5797 3 жыл бұрын
great video bro!!
@zacharydavid565
@zacharydavid565 3 жыл бұрын
Great Video, Bro!
@aboyiphilippa1136
@aboyiphilippa1136 4 ай бұрын
found it very helpful
@elkhanmammadli6267
@elkhanmammadli6267 Жыл бұрын
You are the best bro !!
@bekturasanbekov1979
@bekturasanbekov1979 Жыл бұрын
Thx for video bro !
@nighter1254
@nighter1254 2 жыл бұрын
THANK YOU!
@kingkock1
@kingkock1 2 жыл бұрын
lovin' it
@user-nd4tu4vi6d
@user-nd4tu4vi6d 9 ай бұрын
It was helpful thanks❤
@JustNeutral14.
@JustNeutral14. Ай бұрын
Great tutorial. I like seeing how much java differs from python, which is the tutorial language I learned in school.
@-omarabusnineh5174
@-omarabusnineh5174 3 жыл бұрын
I'm from Jordan, thank's u Bro code u'r professional
@shanksshaki
@shanksshaki 11 ай бұрын
this easy learn thanks of course !!!
@dawidbudkiewicz4509
@dawidbudkiewicz4509 Жыл бұрын
Great tutorial bro
@icm0320
@icm0320 4 ай бұрын
Great tutirial ever !!!!!
@ibrahimylmaz8378
@ibrahimylmaz8378 2 жыл бұрын
you are amazing!
@huseinrahiym463
@huseinrahiym463 3 жыл бұрын
Look at the thumbnail though!!😂😂😂😂
@mukandeinc
@mukandeinc Жыл бұрын
Thanks Giga Bro🔥
@ananthan_sreekumar
@ananthan_sreekumar 7 ай бұрын
thanks for this tutorial bro
@joshuaraymond4996
@joshuaraymond4996 2 жыл бұрын
Thanks. good class
@karimmuhammad149
@karimmuhammad149 2 жыл бұрын
enjoyed!
@bartomiejsniadach5795
@bartomiejsniadach5795 2 жыл бұрын
Another lesson that i understood
@ahmedJm1
@ahmedJm1 Жыл бұрын
ty bro sm
@jaylordjl6337
@jaylordjl6337 2 жыл бұрын
Sometimes it does not work or maybe i just missing something in my code after i implement the nextLine() method to eat some extra white space; but yeah its very helpful, Thanks bro
@Anees-qf8so
@Anees-qf8so 7 ай бұрын
you are a true gigaChad programmer bro!!!
@ismailhossainv1
@ismailhossainv1 2 жыл бұрын
Amazing
@kgsimpt
@kgsimpt 2 жыл бұрын
Thank you Bro!
@Vijay_Isaac
@Vijay_Isaac Жыл бұрын
Thank You ❣
@trickysachin
@trickysachin 2 жыл бұрын
Thanks❤ for it bro
@kirillutsenko9306
@kirillutsenko9306 2 жыл бұрын
good lesson, bro
@eugenezuev7349
@eugenezuev7349 3 ай бұрын
great!
@thedevbek
@thedevbek 2 жыл бұрын
I just love your voice, @Bro Code !!
@quanyufeng579
@quanyufeng579 2 жыл бұрын
Really like it
@Sofia-rg3er
@Sofia-rg3er 4 ай бұрын
great!!!
@matinmonshizadeh
@matinmonshizadeh 2 жыл бұрын
thank you bro
@abkcrazyvideos
@abkcrazyvideos Жыл бұрын
great video
@virajhaldar2880
@virajhaldar2880 2 жыл бұрын
Thanks bro :)
@AmberShah786
@AmberShah786 2 жыл бұрын
Thank you
@user-lx8tl2yv5b
@user-lx8tl2yv5b 4 ай бұрын
thanks bro :D
@rinadem5219
@rinadem5219 Жыл бұрын
amazing
@maghacutiahhel9978
@maghacutiahhel9978 2 жыл бұрын
ty
@sumnguyen38
@sumnguyen38 9 ай бұрын
thank you
@electroplayer.
@electroplayer. 9 ай бұрын
Thanks bro😊
@NOTreallyINFERNO
@NOTreallyINFERNO 2 ай бұрын
thank you sir
@kidsnkiddi2337
@kidsnkiddi2337 2 жыл бұрын
Nice Work
@RuthWondwossen
@RuthWondwossen Жыл бұрын
Da best bro in Da entire world
@sairos4057
@sairos4057 2 жыл бұрын
Ty bro
arithmetic expressions in Java 🧮【4 minutes】
4:31
Bro Code
Рет қаралды 92 М.
Java tutorial for beginners ☕
20:28
Bro Code
Рет қаралды 722 М.
🤔Какой Орган самый длинный ? #shorts
00:42
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 2,4 МЛН
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 40 МЛН
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 22 МЛН
#83 User Input using BufferedReader and Scanner in Java
11:48
Learn Java in One Video - 15-minute Crash Course
14:54
Coding with John
Рет қаралды 667 М.
Java Scanner Tutorial #14
12:37
Alex Lee
Рет қаралды 346 М.
Java exception handling ⚠️
7:53
Bro Code
Рет қаралды 103 М.
How Do We Get User Input in Java? - Full Tutorial
16:26
Coding with John
Рет қаралды 38 М.
Learn Java in 14 Minutes (seriously)
14:00
Alex Lee
Рет қаралды 4,6 МЛН
Java access modifiers: (public, protected, private) 🔒
10:13
Java static keyword ⚡
8:18
Bro Code
Рет қаралды 108 М.
Java constructors 👷
10:37
Bro Code
Рет қаралды 169 М.
8 Must Know JavaScript Array Methods
10:05
Web Dev Simplified
Рет қаралды 1 МЛН
iPhone socket cleaning #Fixit
0:30
Tamar DB (mt)
Рет қаралды 14 МЛН
Samsung laughing on iPhone #techbyakram
0:12
Tech by Akram
Рет қаралды 626 М.
Что не так с раскладушками? #samsung #fold
0:42
Не шарю!
Рет қаралды 188 М.
😱Хакер взломал зашифрованный ноутбук.
0:54
Последний Оплот Безопасности
Рет қаралды 894 М.
OZON РАЗБИЛИ 3 КОМПЬЮТЕРА
0:57
Кинг Комп Shorts
Рет қаралды 1,8 МЛН