什么都不想说了,对于java程序员来说再熟悉不过了,直接上代码。
@try{
NSMutableArray *array = [[NSMutableArray alloc] init];
[array objectAtIndex:10];
[array release];
}@catch(NSException *e){
NSLog(@"My god");
CFShow(e);
}
程序输出结果
2011-08-08 09:26:06.856 MyProgress[865:207] My god
*** -[NSMutableArray objectAtIndex:]: index 10 beyond bounds for empty array
Terminating in response to SpringBoard's termination.
如果是不加 异常判断呐,这个程序就崩溃了