home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / javafile / ch02 / Stringcat.java < prev    next >
Encoding:
Java Source  |  1998-12-14  |  732 b   |  30 lines

  1. import java.io.*;
  2.                                                     
  3. /*
  4.  * Stringcat.class prints integers and strings together.
  5.  */
  6. class Stringcat {
  7.  
  8. public static void main (String args[]) {
  9.         String today = "";
  10.         int monthday = 15;
  11.  
  12. /* The string "Today is " and date are concatenated together and
  13.  * assigned to the String today.
  14.  */
  15.         today = "Today is the " + monthday + "th";
  16.  
  17. /* The String today is printed with println
  18.  */
  19.         System.out.println (today);
  20.  
  21. /* Here two text strings are concatenated with the integer
  22.    monthday within the println method.
  23.  */
  24.         System.out.println ("Today is the " + monthday +
  25.         " day of the month");
  26.  
  27. } // end of main ()
  28. }
  29.  
  30.