Method Example
The Code
The code for the sixth class of Java is as follows:
public class MethodExample {
// @param args the command line arguments
public static void main(String[] args) {
// Rudimentary program to show how methods work
Howya();
System.out.println("Again!");
Howya();
}// End of main
/*
While methods can be within main(), it is best to place them
here, between the }}'s for the end of main() and the end of
the class.
*/
/*
Simple method to just print out simple statement.
Note the keywords.
1. public - Can be accessed by all
2. static - It is a method that does not need an associated object
to be created
3. void - Nothing is returned from the method
*/
public static void Howya() {
System.out.println("Hello - How are you");
}
}// End of class