Java question

  • From: "Gilbert Neiva" <gneiva@xxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 30 May 2010 16:04:38 -0600

I'm trying to write a program in Eclipse that quotes four lines from a poem, 
but I'm suppose to write the four lines in one output statement. I'm also 
suppose to put asterisks around the four lined quote. How would I do this all 
in one statement? The program I wrote is below.

// Application HatchesTheEgg
// This application will write
// four lines from
// Dr. Seuss's Horton's
// Hatches the Egg

import java.io.*; // Imports the java.io package

public class HatchesTheEgg
{
 public static void main(String[] args)
 {
  final String phrase1 = "I meant";
  final String phrase2 = "I said";
  final String phrase3 = "an elephant's faithful";
  final String phrase4 = "one hundred percent";
  final String stars = "***************************";
  System.out.println(stars);
  System.out.println("* "+phrase1+" what "+phrase2+"     *");
  System.out.println("* and "+phrase2+" what "+phrase1+" *");
  System.out.println("* "+phrase3+"  *");
  System.out.println("* "+phrase4+"     *");
  System.out.print(stars);  
 }
}

Gilbert Neiva

Other related posts: