标题:程序老是报错 求解释
取消只看楼主
hongshuai567
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2012-5-29
结帖率:50%
已结贴  问题点数:5 回复次数:0 
程序老是报错 求解释
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication4;

/**
 *
 * @author lihongshuai
 */
public class JavaApplication4 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       int i=0;
        math mymath = new math();
        for(i=1;i<=20;i++) {
            System.out.println(mymath.f(i));
        }


        // TODO code application logic here
    }
class  math
{
    public int f(int x)
    {
        if(x==1 || x==2) {
                return 1;
            }
        else {
                return f(x-1)+f(x-2);
            }
        }
}
}
搜索更多相关主题的帖子: public package command void 
2012-09-23 09:49



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-381918-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.494031 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved