Signing greeting cards in Java

Buddy of mine recently had a baby for the first time. He and his wife are Java developers. So, I thought how about signing his congratulations card in a language we speak?

Here is the code snippet I came up with. In case if you have something that you like to share, feel free…

		public class Life {
		  public static void main(final String args[]) {
			boolean havingKids = args.length > 2;
			if (havingKids) {
			  System.out.println("Life is about to change forever...");
			  throw new LifeChangingException("Congratulations, " +
				"you are going to discover yourself.... Have fun along the way!!!");
			}
			main(args); //Sometimes you'll wish you are here
						// inspite of StackOverflow:)
		  }
		}

What you think?

  1. I would include their names in arguments so that it is more personal, otherwise it is great…hell it made me write a comment!

  2. Thanks ad… That’s a good suggestion :)

  3. I have modified it ,removed ordinary sysouts with swing :)
    import javax.swing.JOptionPane;

    public class Life {
    public static void main( String args[]) throws LifeChangingException {
    // boolean havingKids = args.length >= 1;
    String input=JOptionPane.showInputDialog(\havingKids?\);
    boolean havingKids = false;
    if(!input.equals(\))
    havingKids=true;

    if (havingKids) {
    throw new LifeChangingException(\Life is about to change forever…

    Congratulations, \ +
    \you are going to discover yourself….
    Have fun along the way!!!\);

    }
    }
    }
    And also…
    import javax.swing.JOptionPane;

    public class LifeChangingException extends Exception {

    public LifeChangingException(String string) {
    JOptionPane.showMessageDialog(null, string);
    }

    }

    Hope you like the idea..

  4. Uhmmm

    \ n new lines are not getting displayed pls make changes “\ n” in joption string

  5. Nice… It got swingified:)

    How about a touch hologram?

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

Trackbacks and Pingbacks: