Technology computers-hardware

How to Bring Up a Scanner in Java

    • 1). Right-click the Java file you want to use to bring up the scanner controls. Click "Open With," then click the Java editor in the list of programs.

    • 2). Add the scanner libraries to the top of the Java code. Adding the library makes all of the functions and properties available to your Java functions. Copy and paste the following line of code to the top of the file:

      import java.util.Scanner;

    • 3). Open the file reader. The file reader reads in the file's content before the scanner functions display. The following code opens a file named "myfile.txt":

      FileReader reader = new FileReader("myfile.txt");

    • 4). Open the scanner. The following code displays the scanner control:

      Scanner scan = new Scanner(fin);

    • 5). Scan the file's content in the scanner. You must loop through each section of the file to scan the content to the printer. The following code scans the opened document line-by-line until the reader completes the loop:

      while (scanner.hasNext()) {
      str = scanner.next();
      }

Related posts "Technology : computers-hardware"

Innovative And Economical Vxa Tape Technology

Hardware

How to Save a Document to a Flash Drive From Open Office

Hardware

NAS vs DAS, Which Is Better And Why?

Hardware

How to Flash BIOS on a Acer Aspire 5517 Laptop

Hardware

Jet Tec Canon Pg510 And Cl511 Ink Cartridges From Uk Ink Supplies

Hardware

How do I Hook Up My 3M X55i Projector to My Computer?

Hardware

How to Conduct Remote Management of an HP Laserjet 4050

Hardware

How to Copy Games to a Hard Drive

Hardware

How to Hide Windows System Tray Icons

Hardware

Leave a Comment