001 /** 002 * Exercise 2.7. The program prints three arguments from the command line. 003 * 004 * @author Kristian Torp, torp (at) cs (dot) aau (dot) dk 005 * @version 1.0 006 */ 007 public class Exercise2_7 { 008 /** 009 * The main method. 010 */ 011 public static void main(String[] args) { 012 // check exactly three arguments provided 013 if (args.length != 3) { 014 System.out.println("Provide exactly three arguments!"); 015 } else { 016 // write out the arguments using a for loop 017 for (int i = 0; i < args.length; i++) { 018 System.out.println(" " + i + " :" + args[i]); 019 } 020 } 021 } 022 }