import java.io.*;public class isSorted
{
public static int n;
public static int[] m;
public static void main(String[] args)
{
java.util.Scanner scan = java.util.Scanner.create(System.in);
int len;
m = new int[20];
len=scan.nextInt();
for(int i=0; i<len; i++)
m[i]=scan.nextInt();
}
{
public static int n;
public static int[] m;
public static void main(String[] args)
{
java.util.Scanner scan = java.util.Scanner.create(System.in);
int len;
m = new int[20];
len=scan.nextInt();
for(int i=0; i<len; i++)
m[i]=scan.nextInt();
}
解决方案 »
- javascript中window.onload和body onload冲突的解决方法
- 怎么把写好的游戏代码(eclipse写的)弄成游戏啊?
- 怎么在javascript里让struts表单提交
- \267\265\273\330\ 是什么编码格式???
- String类中的public String[] split(String regex,int limit)方法怎么用
- 新手新问,拜托了!
- 如何将字符串的合并以最快的速度实现??
- 请问这是什么原因
- 不用同步也可实现多线程银行存款操作????
- 初步编写的Java坦克大战代码,未实现敌人坦克的发射和爆炸效果,求解答?
- 关于JVM的性能测试
- 如何指定读取文件中的第几行到第几行的信息呢!
1、检查你的classpath设置是否正确。
2、另外java.util包中好像没有Scanner类。 -_-!
import java.io.*;public class input{
public void main(String args[]){
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s;
System.out.println("输入一个字符!");
s=br.readLine();
System.out.println("s: "+s);
}
}错误:
D:\JAVA\programs>javac input.java
input.java:8: unreported exception java.io.IOException; must be caught or declar
ed to be thrown
s=br.readLine();
^
1 error
难道是CLASSPATH的问题么?
一般的I/O操作都回抛出一个IOException异常
public void main(String args[]){
try {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s;
System.out.println("输入一个字符!");
s=br.readLine();
System.out.println("s: "+s);
} catch (Exception ex) {}
}
}
public void main(String args[]) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s;
System.out.println("输入一个字符!");
s=br.readLine();
System.out.println("s: "+s);
}
}
must be caught or
declared to be thrown(或者throws IOException)
...为什么只导入io包,后面要用到java.util.Scanner类,还要加上
import java.util.*;