Results 1 to 6 of 6
Thread: functional/procedureal Methods
- 01-09-2009, 03:06 AM #1
Member
- Join Date
- Jan 2009
- Posts
- 31
- Rep Power
- 0
functional/procedureal Methods
In one of my computer science modules it explains that a procedural method "cause one or more actions to occur from within the method" and "may receive values when invoked / called " and a functional method "performs a calculation and returns a result / value". What does this actually mean? When the assignment asks me to use procedural method, what is it asking for?
-
a procedural method and functional method are very similar except that the procedural method returns nothing. When you define it, you state that it returns "void" or nothing. For instance:
Procedural method:
Functional method:Java Code:public void printMyName(String name) { System.out.println("My name is " + name); }
Java Code:public int calcMyAge(int yearOfBirth, int currentYear) { return currentYear - yearOfBirth; // must return an int result }
-
(this brings back memories of my Turbo Pascal and Delphi days)
- 01-09-2009, 03:49 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I think those words are rarely used in Java. But in C/C++ it's used. I hope there is no huge different at all, isn't it, except that return something or not.
- 01-09-2009, 03:32 PM #5
Member
- Join Date
- Jan 2009
- Posts
- 31
- Rep Power
- 0
Thanks for the help. I guess when they are asking me to do the assignment with functional methods, they mean to use code that will return values?
- 01-09-2009, 05:40 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yep, that's the meaning. Fubarable clearly state that on his posts.
Similar Threads
-
Trouble with static methods and boolean equals() methods with classes
By dreamingofgreen in forum New To JavaReplies: 8Last Post: 04-16-2012, 11:00 PM -
Non functional radio buttons and messed up array
By flameofSuzaku in forum New To JavaReplies: 2Last Post: 01-10-2011, 05:38 PM -
Get and Set Methods
By kian_hong2000 in forum New To JavaReplies: 10Last Post: 08-27-2008, 02:06 PM -
JSP methods example
By Java Tip in forum Java TipReplies: 0Last Post: 01-30-2008, 10:00 AM -
methods
By Zensai in forum New To JavaReplies: 10Last Post: 12-03-2007, 05:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks