Results 1 to 2 of 2
- 08-05-2007, 11:04 PM #1
Member
- Join Date
- Jun 2007
- Posts
- 14
- Rep Power
- 0
invoking method and output questions
Quick question
Java Code:public static int fun(int n, int k) { if (k<= 0) return 2; if (k>=n) return 5; return fun(n-1, k-1) + fun(n-1, k); }
Trying to get a feel for methods and how they work, especially being able to look at methods and try to tell what they do and what types of output I would get. For the above example, suppose I invoke the method with the following parameters fun(5,2), what would my output be?
Also, how would I invoke this method in my main()?
Much appreciate the help as always! :)Last edited by levent; 08-05-2007 at 11:51 PM. Reason: bluekswing: please do not forget to place [code] tag around your code segments.
- 08-06-2007, 06:36 AM #2
Similar Threads
-
[SOLVED] Invoking a Stateful Session Bean as Stateless
By JThangiah in forum Enterprise JavaBeans (EJB)Replies: 3Last Post: 07-17-2008, 09:35 AM -
questions
By Gilgamesh in forum New To JavaReplies: 3Last Post: 11-27-2007, 11:18 PM -
3 Questions
By hiranya in forum AWT / SwingReplies: 4Last Post: 11-14-2007, 04:57 AM -
Invoking superclass methods... how?
By rhobincu in forum New To JavaReplies: 7Last Post: 08-09-2007, 03:10 PM -
mapping servlets in user defined xml file and invoking them
By praneeth in forum Advanced JavaReplies: 0Last Post: 07-16-2007, 08:45 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks