java.lang.ClassCastException

是指类型转换出错

当前者的域小于后者的时候出现 

譬如说:前者A是子类的对象,而后者B是父类的对象 

若使用A = B;就会抛出java.lang.ClassCastException

 

		List<CustomerVO> customers=  (List<CustomerVO>) new CustomerVO();
		List<CustomerVO> customers = new ArrayList<CustomerVO>();

 上面一种写法就是会报出这样的错误的,因为CustomerVO 不属于List的子类

posted on 2015-03-05 14:03  手撕高达的村长  阅读(1806)  评论(0编辑  收藏  举报

导航