有时希望把刚捕获的异常重新抛出,尤其是在使用Exception捕获的异常的时候。既然已经得到了对当前异常对象的引用,可以直接把它重新抛出:catch(Exception e){ Systyem.out.println(“An exception was thrown”); throw e;}重...
分类:
编程语言 时间:
2014-06-24 13:54:48
阅读次数:
275
深度优先算法
问题
给定一个有向图,判断其顶点能否到达另外一个顶点。
解决办法
使用深度优先算法,和无向图中的是一样的。
代码
import java.util.Stack;
/**
* Created by caipeichao on 14-6-11.
*/
public class Digrap...
分类:
其他好文 时间:
2014-06-22 21:32:28
阅读次数:
250
先普及小知识:
STL 中栈的使用方法(stack)
基本操作:
push(x) 将x加入栈中,即入栈操作
pop() 出栈操作(删除栈顶),只是出栈,没有返回值
top() 返回第一个元素(栈顶元素)
size() 返回栈中的元素个数
empty() 当栈为空时,返回 true
STL 中队列的使用(queue)
基本操作:...
分类:
其他好文 时间:
2014-06-22 19:09:51
阅读次数:
169
public class StringUtil {
public static String str = "696d706e7274";
public static void main(String[] args) {
try {
System.out.println(new String(getBytes(str)));
} catch (Exception e) {
//...
分类:
其他好文 时间:
2014-06-22 17:48:40
阅读次数:
185
xml解析报错:Invalid byte 2 of 2-byte UTF-8 sequence
在做接口解析时候出现的错误:Invalid byte 2 of 2-byte UTF-8 sequence. Nested exception: Invalid byte 2 of 2-byte UTF-8 sequence.
很明显是在读取XML文件时候出现的编码问题!
在测试过程中发...
分类:
其他好文 时间:
2014-06-22 16:26:26
阅读次数:
143
理解异常在javaScript面向对象编程是非常重要的,异常是一种非常强大的处理错误的方式。
错误处理
首先我们来看一个有问题的代码:
nonexistant();
在以上这个例子中,访问一个不存在的变量,在这种情况下,程序会怎么处理?很早以前的处理方式就是程序直接崩溃死掉,所以我们不能容忍这种处理方式,需要有办法来处理。
最简单的处...
分类:
编程语言 时间:
2014-06-22 12:15:49
阅读次数:
236
TGLStackedViewControllerA stack layout with gesture-based reordering using UICollectionView -- inspired by Passbook and Reminders apps.这是一种使用了UICollec...
分类:
其他好文 时间:
2014-06-22 10:47:19
阅读次数:
290
一介绍:
`.ARM.exidx` is the section containing information for unwinding the stack. If your C program has functions that print out a stack backtrace, the functions will likely depend on this section bei...
分类:
其他好文 时间:
2014-06-22 00:31:07
阅读次数:
618
Eclipse运行程序提示:Exception in thread "main" java.lang.OutOfMemoryError: Java heap space...
分类:
编程语言 时间:
2014-06-21 21:41:22
阅读次数:
336
1.顺序容器的类型顺序容器:vector 支持快速随机访问list 支持快速插入/删除deque 双端队列顺序容器适配器:stack 后进先出(LIFO)栈queue 先进先出(FIFO)队列priority_queue 有优先级管理的队列
分类:
其他好文 时间:
2014-06-21 15:31:26
阅读次数:
235