GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing www.dremendo.com — Input in Java Programming | Dremendo
?>
Announcements
No new announcements.
Java Programming Tutorial
Table of Contents
Input in Java ProgrammingIn this lesson, we will understand what is Scanner class, and how it is used in the Java program to accept input with the help of some examples. Input in JavaThe Scanner class is used in Java programs to accept input from the standard input device (keyboard) and store it in one or more variables. The Scanner class is available in the java.util package.
Video Explanation
Click the button below to watch the explanation.
Please wait while the video is loading....
To use the Scanner class, we need to create an object of the Scanner class and use the available methods in the class to take different types of input from the user. The available methods in the Scanner class are listed below.
Let's see an example of how to use Scanner class to read different types of data from the keyboard.
Example
Output
What Happens in the Example
Enter your age: 15 Enter your height in meters: 3.423 Enter your weight in kilogram: 45.21543 Enter the first character of your name: R You entered: Age: 15 Height: 3.423 Weight: 45.21543 Initial: R
Test Your KnowledgeAttempt the questions in the exercise to check whether you have understood the lesson clearly.
We care about your privacyDremendo uses cookies and similar technologies that are necessary for the site to work properly, understand how you interact with our website, and measure the effectiveness of our marketing. By clicking Accept All, you consent to the use of non-essential cookies and similar technologies for analytics, advertising, and ad measurement, as described in our Privacy Policy. Cookie PreferencesChoose which types of cookies Dremendo may use.
Necessary Cookies
Allow
Required for essential website functionality and security.
Analytics Cookies
Allow
Help us understand how visitors use Dremendo.
Marketing Cookies
Allow
Help us measure advertising performance and understand interactions with our advertisements.
Mentora
Question Asked: 0 / 20
Hi, I’m Mentora! I’m your personal AI tutor from Dremendo. Ask me anything, and I’ll help you understand it in a simple and easy way. | ||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |