Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javiermoreno.dominajava.puzzlers;
- import java.util.Random;
- /**
- *
- *
- * @author Java Puzzlers http://www.youtube.com/watch?v=yGFok5AJAyc
- */
- public class Hamlet {
- public static void main(String[] args) {
- Random rnd = new Random();
- boolean toBe = rnd.nextBoolean();
- Number result = (toBe || !toBe) ? new Integer(3) : new Float(1);
- System.out.println("*****************");
- System.out.println(result);
- }
- }
- // El operador ternario no se comporta especialmente bien con diferentes tipos
Advertisement
Add Comment
Please, Sign In to add comment