answersLogoWhite

0

The Scanner class alows users to enter data. Example:

import java.util.Scanner

Scanner scan = new Scanner (System.in);

String input;

System.out.println ("Enter a word or phrase.")

input = scan.nextLine ();

System.out.println ("You entered: " + input);

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

How could a program use a class Scanner without importing it in java programming?

You can use the full name of the class. In your case example: java.util.Scanner scanner = new java.util.Scanner(System.in);


How do you store fingerprints in java?

Java has no built-in framework for dealing with biometric data, fingerprints included. If you wanted to build your own class, it would be sensible to store the information in the same way your fingerprint scanner passed it on. If the scanner gives you an image, store the image. If the scanner gives you a bunch of numbers, store a bunch of numbers.


How to create a Java scanner class to add two numbers?

http://javacodespot.blogspot.com/2011/04/java-programming-using-scanner-for-user.html import java.util.*; public class ScannerClass { public static void main(String[] args) { Scanner scan=new Scanner(System.in); System.out.print("1st num: "); int num1=scan.nextInt(); System.out.println(); System.out.print("2nd num: "); int num2=scan.nextInt(); int sum=num1+num2; System.out.println(); System.out.println("Sum: "+sum); } }


Extension file for Java?

Java source files have the .java extension, compiled Java class files have the .class extension.


What is a Java scanner used for?

A Java Scanner is used for reading and producing several types of computer values. Using Java Scanners helps one easily read user input. There is a free course one might take to get better acquainted with Java Scanners provided by Java.


How do you get double numbers from keyboard in java?

import java.util.*; public class Example { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Please enter a Double:"); double numDouble = in.nextDouble(); } }


What is the difference between nextLine and next method in scanner class java?

nextLine() reads a complete line while next() reads the next token ( a single word)


The actions in a java class are called?

The actions in a java class are called methods.


Why you start java program by class?

without class non of the folder can run so the java program should start in class we can use the class without object in java


How do you convert a scanner to string in java?

I assume that your scanner is not scanning a string already, so if you are scanning an int then you can do: for the example you scanner variable is x .... x.intparseString();


What does import java.util.Scanner?

It is used import your scanner class. In other words bringing in the scanner class.


How do you call main class with in main class in java?

We can't call a class. We always call a method in java.