Helps You Can See During the Loop and Decision Test
public class MyClassName
{
public static void main( )
{
// your statements here ending in semi-colon
}
public static int otherroutine(double x, String y)
{
// your statements here ending in semi-colon
}
}
Creating methods:
public static return_type method_name (type parm1, type parm2)
{
...
...
return expression;
}
Calling methods:
object_or_class.method_name(parm1, parm2);
If / if else / else
if (condition that evaluates to true or false)
{
// do something
}
else if (condition that evaluates to true or false) // remember that everything that met first criteria doesn't get here
{
// do something else
}
.
. // repeat else if as needed
.
else // remember to put no condition
{
// do something
}
Loops
For loop - repeats when you know the number of times to repeat
for (statement to start the loop; condition that evaluates to true or false; statement to run when the loop repeats)
{
// do something
}While loop - repeats until some condition is met
while (condition that evaluates to true or false)
{
// do something
// at some point, set the condition to stop
}
(See your Java Tools)