// Examples of some methods with void return type, or with no parameters import java.util.Scanner; public class Voids { public static Scanner input = new Scanner(System.in); public static void main(String[] args) { char result; result = getALetter(); // no parameters, but returns a char printQuotient(9, 5); // void function. call by itself printQuotient(5, 0); System.out.println("Before killSomeTime() is called"); killSomeTime(); System.out.println("After killSomeTime() is called"); } public static char getALetter() { boolean isLetter; char let; do { System.out.print("Please enter a letter of the alphabet: "); let = input.next().charAt(0); isLetter = (let >= 'A' && let <= 'Z') || (let >= 'a' && let <= 'z'); if (!isLetter) System.out.println("Not a letter. Try again.\n"); } while (!isLetter); return let; } public static void printQuotient(int x, int y) { if (y == 0) { System.out.println("I'm not going to divide by 0 !"); return; } System.out.println("The quotient of " + x + " divided by " + y + " is: " + (x / y) ); } public static void killSomeTime() // this function is going to just delay a little { long x = 0, y; while (x < 5000000000L) // note: the L on this literal ensures { // it will be interpreted as type long y = x * x; x++; } } }