People.engr.tamu.edu



Methods II

Mechanics of a Method (review)

|public static void main(String args[]) | |public void printmenu() |

|{ | |{ |

|… ( | | |

|… | | |

|app.printmenu( ); // calling | |( |

|// NEXT LINE | | |

|( | | |

|} | |} |

| |

|class Whatever |

|{ |

|public static void main(String args[]) |

|{ |

|… |

|… |

|… |

|app.printmenu(); |

|… |

|… |

|… |

|} |

|public void printmenu() |

|{ |

|… |

|… |

|} |

| |

|} |

Parts of function

| ( ( ( |( return type |

|public void getFunction( ) |( function name |

|{ |( ( )’s |

|int a = 10; ( |parameter list, (get into later), ALWAYS needed |

|int b = 13; ( |( local variables |

|int x = a + b; ( | |

| | |

|cout ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download