readtextprices.java
来自「《A first book of java》by Gary J.Bronson 」· Java 代码 · 共 27 行
JAVA
27 行
import java.io.*;
public class ReadTextPrices
{
public static void main(String[] args)
throws java.io.IOException
{
String fileName = "prices.txt";
int i;
String inLine;
// set up the basic input stream
FileReader fr = new
FileReader(fileName);
// buffer the input stream
BufferedReader br =
new BufferedReader(fr);
// read and display three lines
for(i = 0; i < 3; i++)
{
inLine = br.readLine(); // read a line
System.out.println(inLine); // display the line
}
br.close();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?