NextYear.java


Below is the syntax highlighted version of NextYear.java.


 /***********************************************************************
  *   Name:     Kevin Wayne
  *   Login:    wayne
  *   Precept:  P05
  *
  *   Inputs 2 command line arguments.  
  *   Converts 2nd argument to an integer and adds one to it.
  *   Example of difference between + for concatenation and + for addition.
  *   Outputs sentence.
  *
  *   Compilation: javac NextYear.java
  *   Execution:   java NextYear name age
  *
  *   > java NextYear Alice 19
  *   Next year Alice will be 20 years old.
  *
  ***********************************************************************/
  public class NextYear {
      public static void main(String[] args) {
         
          System.out.print("Next year " + args[0] + " will be ");
          System.out.print(Integer.parseInt(args[1]) + 1);
          System.out.println(" years old.");

      }
  }