public class Digui {
public int getData(int index){
int result =0;
if(index == 0){
result = 0;
}else if(index ==1 || index ==2){
result = 1;
}else{
result = getData(index-1) + getData(index-2);
}
return result;
}
public static void main(String[] args) {
Digui digui = new Digui();
int result = digui.getData(6);
System.out.println(2+”–>”+result);
}
}