A Poem in Java

Not sure if anyone knows this, but I have an interest in programming in addition to the writing. I studied Java in high school and decided to use it in a poem.

It is a silly poem that I made out of boredom. I’ll share the before and after.
/**
* A Poem in Java
*
* @author Naylene Rondon
* @version V1
*/
public class Poem
{
public static void main(String[]args)
{
System.out.println(“A Poem in Java”);
System.out.println(“It’s really a waste of time”);
System.out.println(“Something to do because I can”);
String [] rhymes = new String [5];
rhymes[0] = “cat”;
rhymes[1] = “hat”;
rhymes[2] = “bat”;
rhymes[3] = “sat”;
rhymes[4] = “fat”;
System.out.println(“I can easily print a list of rhymes”);

for(int i = rhymes.length- 1; i >= 0; i–)
{
System.out.println(rhymes[i]);
}

System.out.println(“Then do it all again”);
for(String a : rhymes)
{
System.out.println(a);
}

System.out.println(“I can make words from other words”);
String original = “Cryptogram”;
String one = original.substring(0,3);
String two = original.substring(4,6);
System.out.println(two + ” ” + one + ” is to have tears”);

System.out.println(“From afar looks so odd and uneven”);
System.out.println(“Yet once compiled is all become clear”);
System.out.println(“None of this really makes much sense”);
System.out.println(“Yet, it was fun to make”);
System.out.println(“A Poem in Java”);
}
}

 

After Compiled:

A Poem in Java
It’s really a waste of time
Something to do because I can
I can easily print a list of rhymes
fat
sat
bat
hat
cat
Then do it all again
cat
hat
bat
sat
fat
I can make words from other words
to Cry is to have tears
From afar looks so odd and uneven
Yet once compiled is all become clear
None of this really makes much sense
Yet, it was fun to make
A Poem in Java

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s