Java Software Solutions > PP1.4 > Solution

Problem:

Write an application that prints the phrase Knowledge is Power:
a. on one line
b. on three lines, one word per line, with the words centered relative
to each other
c. inside a box made up of the characters = and |

Output:

Not available.

Solution:

class Knowledge
{
   //-----------------------------------------------------------------
   //  Prints a phrase in various configurations.
   //-----------------------------------------------------------------
   public static void main (String[] args)
   {
      System.out.println ();
      System.out.println ("Knowledge is Power");
      System.out.println ();
      System.out.println ();
      System.out.println ("Knowledge");
      System.out.println ("   is");
      System.out.println ("  Power");
      System.out.println ();
      System.out.println ();
      System.out.println ("==========================");
      System.out.println ("|                        |");
      System.out.println ("|   Knowledge is Power   |");
      System.out.println ("|                        |");
      System.out.println ("==========================");
      System.out.println ();
   }
}

1 comment:

  1. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!. .Net FrameWork Offline Installer

    ReplyDelete