Lucky Cat Tutoring Services


October 13, 2009, 4:07 pm
Filed under: Uncategorized | Tags: , , , ,

Methods:Stand alone units, or blocks of code that do a specific task.
–EXAMPLE: public static void main(String []args) <—a main method
–the "public" means it's public, "void" returns nothing, "(String[]args)" returns the string

Step-line Refinement: Creating routines and methods to break the code down into more manageable and efficent parts.

MAKING A METHOD
1) Call the method inside the main method: any method that is called inside the main must also be STATIC!

Example: public static void printStar()
{
}
KEY POINT:METHODS CAN NEVER BE INSIDE ANOTHER METHOD! It’s inside the class, but outside any other method!

2) next put the required method code inside the {} to make the method, making sure that the block of code stands alone.

3)INVOKING THE METHOD: put the method in the code by putting the method name and ()

Continue reading

Advertisements


Free Programming Reference Cards
October 8, 2009, 3:50 pm
Filed under: Java | Tags: , , , ,

Programmer Ref Cards from Dzone. Free Sparknotes style cheat sheet references for programmers and students. Registration to the site is free too!