标签:style blog color io java ar 数据 div sp
---恢复内容开始---
1)用bufferedReader,导入io包
import java.io.*; public class A { public static void main(String[] args) throws IOException { BufferedReader buf;//定义BufferedReader 的对象buf String str; ............... buf = new BufferedReader(new InputStreamReader(System.in));//创建buf对象 str = buf.readLine();//用readLine方法读取字符 ............... }
2)用Scanner,导包uti
import java.uti.*; public class A { public static void main(String[] args) { Scanner buf=new Scanner (System.in); int i;double j; System.out.println("请输入一个值:"); i=buf.nextInt(); System.out.println("请输入一个值:"); j=buf.nextDouble(); ................ }
---恢复内容结束---
标签:style blog color io java ar 数据 div sp
原文地址:http://www.cnblogs.com/lcpholdon/p/3978953.html