文章标题

来源:互联网 发布:vs2015 知乎 编辑:程序博客网 时间:2024/06/15 18:42

package fangzao.www;
public class test{
public static void main(String[] args) {
test e = new test();
// System.out.println();
System.out.println(“结果是”+e.Test(5));
}

    public double Test(double index) {        if (index == 1) {            return 1;        }        if (index == 2) {            return 1;        }        //double namber=Test(index-1) + Test(index - 2);       System.out.println(index);        return Test(index-1) + Test(index - 2);    }}