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?
I would include their names in arguments so that it is more personal, otherwise it is great…hell it made me write a comment!
Thanks ad… That’s a good suggestion
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..
Uhmmm
\ n new lines are not getting displayed pls make changes “\ n” in joption string
Nice… It got swingified:)
How about a touch hologram?