fault,error,failure

public int findLast(int []x ,int y){

for( int i=x.length-1;i>0;i--){

If(x[i]==y){

return i;

}

}

return -1;

}

 

Falut: for循环中i应该是 i>=0,而不是i=0.

没有执行faultcase :  Text:x=[],y=0;

执行了fault但不是errorcase:  text: x=[1,2,3] , y=3

Error但不是failurecasetext: x=[3,4,5],y=3

 

 

 

public int lastZero(int []x){

for( int i=0;i<x.length;i++){

If(x[i]==0){

return i;

}

}

return -1;

}

Falut: for循环中应该从x.length-10而不是0x.length

没有执行faultcase:  text: x=[]

执行但不是errorcase: text: x=[0,1,2]

Error但不是failurecase :  text:x=[0,1,0]

posted on 2018-03-12 22:41  mxwmwx  阅读(206)  评论(0编辑  收藏  举报