请教一个简单的阶乘递归的问题 我已将类Cs1的关键字public去掉了还是报错。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 class Cs1{ public int chen(int i) { if(i == 0) return 1 ;//改一下。 else return (i* chen(i -1)) ; }}public class Cheng { public static void main(String[] args) { int n ; int j = 10 ; Cs1 se = new Cs1() ; n = se.chen(j) ; System.out.println(n) ; } } class Cs1 { public int chen(int i) { System.out.println(i) ; if(i == 0) { i = 1 ; return 0; } else { return (i* chen(i -1)) ; } }}public class Cheng { public static void main(String[] args) { int n ; int j = 100 ; Cs1 se = new Cs1() ; n = se.chen(j) ; System.out.println(n) ; } } 为什么JAVA运行老出错 SQ语句关联三张表错了, 不知道为什么 用JTextArea 如何实现剪切,复制,拷贝功能?????? java的编译工具问题(急呀)! 面向对象基础概念有点不清楚 用java做试题库行吗? 怎么把一个目录下是.pdf和.rar,.zip的所有文件列出来。 本人有C/C++,DELPHI,VB的基础,想改学Java,该从何做起? Applet的一个问题 谁有JBuilder 5企业版的注册码?? JBuilder7中数据库操作的一个问题 java中float数据的格式问题
{ public int chen(int i)
{
if(i == 0)
return 1 ;//改一下。
else
return (i* chen(i -1)) ;
}
}public class Cheng
{
public static void main(String[] args) {
int n ;
int j = 10 ;
Cs1 se = new Cs1() ;
n = se.chen(j) ;
System.out.println(n) ;
}
}
{
public int chen(int i)
{
System.out.println(i) ;
if(i == 0) {
i = 1 ;
return 0;
}
else {
return (i* chen(i -1)) ;
}
}
}public class Cheng
{
public static void main(String[] args) {
int n ;
int j = 100 ;
Cs1 se = new Cs1() ;
n = se.chen(j) ;
System.out.println(n) ;
}
}