throws---------->把异常交给调用处。可以结合throw来同时使用。throws用在方法声明处,表示本方法不处理异常。可以结合throw使用throw 表示在方法中手工抛出一个异常。 1 class Math { 2 public int div(int i, int j) t...
分类:
其他好文 时间:
2014-09-28 00:44:40
阅读次数:
199
cu红色为检查异常,就是eclipse要提示你是try catch 还是throws。非检查异常,就是/0,nullpointexception,数据越界访问indexOfOutBounds 异常错误: 最常见的oom错误,还有classnotFoundeError,StackOverflowErr...
分类:
编程语言 时间:
2014-09-27 20:58:00
阅读次数:
222
/** * @ClassName TestSocket1 * @Version 1.0 * @Date 2014-9-26 上午10:19:36 */public class TestSocket1 { public static void main(String[] args) throws Un...
分类:
编程语言 时间:
2014-09-26 11:20:28
阅读次数:
234
1). 先会执行 ModelDrivenInterceptor 的 intercept 方法. public String intercept(ActionInvocation invocation) throws Exception { //获取 Action 对象: EmployeeAc...
分类:
其他好文 时间:
2014-09-25 12:09:38
阅读次数:
231
public static void main(String[] args) throws IOException {BufferedWriter bw = new BufferedWriter(new FileWriter("C:/Users/宇超/Desktop/rand.txt"));Buff...
分类:
编程语言 时间:
2014-09-23 23:13:55
阅读次数:
196
public static void main(String[] args) throws IOException {FileInputStream in = null;FileOutputStream out = null;int b=0;in = new FileInputStream("C:\...
分类:
编程语言 时间:
2014-09-23 23:10:15
阅读次数:
181
public static void main(String[] args) throws IOException {FileReader fr = new FileReader("C:/Users/宇超/Desktop/hello.txt");FileWriter fw = new FileWri...
分类:
编程语言 时间:
2014-09-23 22:57:55
阅读次数:
197
filter、sortrunner执行要先过滤和排序。默认的filter是ALL代表全部通过,默认的排序是MethodSorter的DEFAULTParentRunner调用filter和sort方法: public void filter(Filter filter) throws NoTe...
分类:
其他好文 时间:
2014-09-23 18:47:44
阅读次数:
163
1 protected void runTest() throws Throwable { 2 3 try { 4 BaiduLocation bl = new BaiduLocation(); 5 bl.gpsx = 120;//经度 6 ...
分类:
其他好文 时间:
2014-09-23 18:24:35
阅读次数:
241
java.util.concurrent.Future是Java提供的接口,表示异步执行的状态,Future的get方法会判断任务是否执行完成,如果完成就返回结果,否则阻塞线程,直到任务完成。
// Java FutureTask.get()
public V get() throws InterruptedException, ExecutionException {
i...
分类:
Web程序 时间:
2014-09-23 14:11:04
阅读次数:
294