Difference between revisions of "CIS 3020 Part 6"

From In The Wings
Jump to navigation Jump to search
 
Line 16: Line 16:
 
}
 
}
 
</pre>
 
</pre>
|-
+
||
|
 
 
<pre>
 
<pre>
 
public void count2(int x) {
 
public void count2(int x) {

Revision as of 11:46, 13 April 2007

Consider the following two methods:

public void count1(int x) {
  if (X <= 0) {
    System.out.println(x);
  } else {
    System.out.println(x);
    count1(x-1);
  }
}
public void count2(int x) {
  if (X <= 0) {
    System.out.println(x);
  } else {
    count2(x-1);
    System.out.println(x);
  }
}