Velocity Reviews

Velocity Reviews (
-   General Computer Support (
-   -   Problem in Java - Interface and passing methods as parameters (

Hoy2Coy 01-17-2011 07:31 PM

Problem in Java - Interface and passing methods as parameters
I was wondering how to put a method as a parameter in Java. I know there are other posts about this but I can't make sense of them (something to do with interface, right?). I'm relatively new to Java so I just know the basics. The reason I need to be able to do this is because I'm making an interactive story with each section being its own method. In pseudo-code I want it to be something like this:

public class Interactive_Story {

void Choose(Takes methods a and b as parameters){
if (user input=="a"){
Execute method a
if (user input=="b"){
Execute method b

void Start(){
Output beginning of story on the console.

void main (String[] args){


I hope you see what I'm trying to get at. If you have any ideas or informative links please post them as soon as possible.


All times are GMT. The time now is 05:01 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.