Import Statement
Modern programming languages typically include dozens, perhaps hundreds, of prewritten modules of code called libraries. These libraries can be used in your program, so you don't have to reinvent the wheel every time you write a program.
Java uses import to include libraries in the current program and that's how we bring in some of the ACM libraries as well as various standard Java libraries to our program. Import statements are the first code after any comments, as you saw in the programs above.
Here are some examples.
import acm.program.*;
import acm.graphics.*;
import java.util.*;
Modern programming languages typically include dozens, perhaps hundreds, of prewritten modules of code called libraries. These libraries can be used in your program, so you don't have to reinvent the wheel every time you write a program.
Java uses import to include libraries in the current program and that's how we bring in some of the ACM libraries as well as various standard Java libraries to our program. Import statements are the first code after any comments, as you saw in the programs above.
Here are some examples.
import acm.program.*;
import acm.graphics.*;
import java.util.*;
0 comments:
Post a Comment