Skip to content

Commit 4100ee9

Browse files
committed
Added a redefinition error example
1 parent d754eb3 commit 4100ee9

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

samples/FactorialRedefError.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Factorial{
2+
public static void main(String[] a){
3+
System.out.println(new Fac().ComputeFac(10));
4+
}
5+
}
6+
7+
class Fac {
8+
public int ComputeFac(int num){
9+
int num_aux;
10+
int num_aux ;
11+
if (num < 1)
12+
num_aux = 1 ;
13+
else
14+
num_aux = num * (this.ComputeFac(num-1)) ;
15+
return num_aux ;
16+
}
17+
}

0 commit comments

Comments
 (0)