Below is the syntax highlighted version of RandomStudent.java
from §1.4 Arrays.
/****************************************************************************** * Compilation: javac RandomStudent.java * Execution: java RandomStudent * * Print a random student. * ******************************************************************************/ public class RandomStudent { public static void main(String[] args) { String[] names = { "Clelia Zacharias", "Hannah Xu", "Virginia Wylly", "Wendy Wu", "Ashely Wolf", "Eric Whitman", "Will Weidman", "Sharon Weeks", "Mary Wathall", "Sarah Wang", "Michael Wang", "Madeleine Walsh" }; int n = names.length; int r = (int) (Math.random() * n); System.out.println(names[r]); } }