15% OFF EVERYTHING! USE CODE GET15

Haiku.java by ubiquitoid

T-Shirts & Hoodies

Clothing Style:
or
$25.52
Available to buy on…


For literate geeks: An original haiku in (valid) Java.

© Marc Weber. All rights reserved.

Notes on implementation:

  • The top-level HaikuBuilder class is not public, so it can be saved in a file by a different name (e.g., Haiku.java).
  • A Haiku class needs to be defined.
  • A Hai class needs to be defined as a subclass of Haiku (so that a Hai reference can be upcast to type Haiku), and Hai must have a constructor that takes a String argument.
  • Once an instance of HaikuBuilder is created, its compose method can be called to return a reference to a new instance of Haiku.

Related: main method

Tags

java, programming, programmer, language, computer, computers, geek, nerd, internet, web, server, help desk, code, haiku, poetry, verse, humor

desktop tablet-landscape content-width tablet-portrait workstream-4-across phone-landscape phone-portrait