If Shakespeare had been a Java Programmer…

18 Oct

class shakespeare {

public static void main(String[] args) {

try {
String musicBeTheFoodOfLove = new String(args[0]);
if (Boolean.parseBoolean(musicBeTheFoodOfLove)) {
playOn();
}
}
catch (Exception e) {
System.out.println(“Usage: shakespeare <a string value>”);
} // end catch

finally {System.exit(0);}
} // end main;

static void playOn() {
for (int i=1; i < 4; i++) {
System.out.println("Play On!");
}
}
}

command line output
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

%d bloggers like this: