| Author |
Does a recursive function have to be static?
|
Allen Williams
Ranch Hand
Joined: Sep 04, 2006
Posts: 136
|
|
On the web, I've seen examples of Java recursive functions that are declared static and seen examples where they weren't (don't know if these authors tried to compile and run the examples). I came across one reference that explicitly says that recursive functions must be static. A search for "recursive" on the Sun Java Tutorial web site turned up zero hits. When I don't declare mine static, the compiler does not complain. Hence, the above question. TIA
|
-------<br />Thanks & regards,<br />anw
|
 |
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
|
|
|
No, a recursive function (method, in Java) does not need to be declared static.
|
"I'm not back." - Bill Harding, Twister
|
 |
Allen Williams
Ranch Hand
Joined: Sep 04, 2006
Posts: 136
|
|
|
Thanks!!
|
 |
 |
|
|
subject: Does a recursive function have to be static?
|
|
|