m1b on 08/23/11
Last Edited at 08/23/11 06:56am
public class TernaryOp { public static void main(String[] args) { int i = Integer.parseInt(args[0]); System.out.printf("%ni=%s",// switch case with ternary op idiom: i == 1 ? "one" : i == 2 ? "two" : i == 3 ? "three" : "too many!" ); }}
Report this snippet Tweet
Comment:
You need to login to post a comment.