P9 - Getting user input data in Java using scanner class | Core Java |
HTML-код
- Опубликовано: 4 окт 2024
- In this video, I have explained about "Getting user input data in Java using scanner class".
The Scanner class is used to get user input, and it is found in the java.util package.
To use the Scanner class, create an object of the class and use any of the available methods found in the Scanner class documentation. In our example, we will use the nextLine() method, which is used to read Strings:
You can find the program used in this video at the below location:
bit.ly/2SeDMMr
Scanner class provides a few other methods to read different type of data, those are listed below:
nextBoolean() : Reads a boolean value from the user
nextByte() : Reads a byte value from the user
nextDouble() : Reads a double value from the user
nextFloat() : Reads a float value from the user
nextInt() : Reads a int value from the user
nextLine() : Reads a String value from the user
nextLong() : Reads a long value from the user
nextShort() : Reads a short value from the user
==============================================
▶️ Next Video Link: • P10 - Operators in Jav...
◀️ Previous Video Link: • P8 - DataTypes in Java...
↔️ Java for Absolute Beginners Playlist Link: bit.ly/3keRJGa
✴ Checkout my other playlists: bit.ly/3gLIAVL
☕ Buy me a coffee: bit.ly/33ljBWc
👑 Join my youtube channel to get access to perks:👇
/ @hyrtutorials
==============================================
==============================================
Connect us @
🔗 Website - www.hyrtutoria...
🔗 Telegram - t.me/hyrtutorials
🔗 Facebook - / hyrtutorials
🔗 LinkedIn - / hyrtutorials
🔗 Twitter - / hyrtutorials
🔗 Instagram - / hyrtutorials
==============================================
==============================================
🙏 Please Subscribe🔔 to start learning for FREE now, Also help your friends in learning the best by suggesting this channel.
#hyrtutorials #java #corejava
Java programming by Yadagiri Reddy
↔ Java for Absolute Beginners Playlist Link: bit.ly/3keRJGa
✴ Checkout my other playlists: bit.ly/3gLIAVL
☕ Buy me a coffee: bit.ly/33ljBWc
The 26 letters in an alphabet cannot describe how good your explanation is....🤗🤗
Ohh thank you so much buddy 😊
Best RUclips channel to learning java
Simply no words for your fantastic presentation 🎉🎉🎉
Thanks buddy 😊
As you mentioned its absolute, its so true. I wish I have known this channel earlier. I liked the way you explain....
Do you have any videos for collections in Java and can you pass some good info to study. 🙏🙏🙏
Master ji...nenu mana channel lo vunna java videos choosanu chaalaa bagunnayi ...pls keep upload videos anna it will very useful for us.
Thankyou buddy 😊
Thank you so much for showing the way
Anna1000 likes kottina takkuvey anna mee videos ki super anna❤
Thanks buddy 😊
Great effort for us
Thanks for liking buddy 😊
Simply superb 👌
Thank you 😊
Good teaching
Super explanation sir 🎉❤
Thanks buddy 😊
With the reference of kips learning,In if statement and if else statement i didn't see any closing of scanner method.Is it okay leave it like that.
Superb video sir very nice and clear explanation🙏
Thanks buddy
nice explanation anna 👏
even after importing java,util package i am still getting error
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Scanner cannot be resolved to a type
Scanner cannot be resolved to a type
at JavaBegin/practicePrograms.Input.main(Input.java:14)
even after imported java.util for scanner program it is throwing this error
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Scanner cannot be resolved to a type
Scanner cannot be resolved to a type
at JavaBegin/practicePrograms.Input.main(Input.java:14)
I am using java 11
Sir... For output stream we directly writting like System.out...... But for input stream why we r creating object "new"
We are creating the object for scanner class buddy but not for the input stream.
Good tesch
Thankyou buddy 😊
nice lecture anna thank you..
Thankyou buddy 😊
I am Getting error at the time of output that is i am able to print only two outputs more than that not able to run the output
Remaining topics kuda upload cheyandi brother.
Very soon will upload them renuka
it is really good.
but where it is used in real Testing scenarios?
please give some real examples.
It depends on our scenarios Vignesh.
If u want to take any inputs from the command prompt while executing your automation tests then you can use this.
Inputs like url, suitename etc..
@@HYRTutorials yes. thank you
Why can't we define IMPORT in class? Why are we defining it in package ?
Imports are defined outside class block.
So that's why we define them at the starting of the java file just after the package.
Incase if u don't have any package then imports will be at the top.
Class is a representation of a real world object ryt.
That's why class will have only properties (variables) and actions (methods)
@@HYRTutorials so imports are like pulling some functionalities from a repository? Ryt?
@@HYRTutorials thanks for the detailed and brisk response, sir.
@@SaicharanDasari026 in java we try to utilise some other class functions also ryt either it can be part of the java language or it is coming from one of your projects.
So to use those inside the present class we need to create a connection kind of thing.
Imports will create that bridge for us.
They import that package references into present class. So that you can access the functions.
@@HYRTutorials ok sir. Now I get it. Any classes can be imported. It is advantage of java! Kaada?
Tq bro
Happy learning buddy 😊