What Does "Import Java. Util. Scanner;" Mean?

What do the import statements at the beginning of files mean?

As an example, this program calculates the total price which includes sales tax:

 import java.util.Scanner;

 public class SalesTax { 
    public static void main(String[] args) { 
              //identifier declarations 
    }
 }
5

1 Answer

It tells the compiler, that any time you use a Scanner, you mean the one which is located in java.util

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest