Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.genuinevm.puzzlers;
- import java.util.Arrays;
- import java.util.List;
- import java.util.stream.IntStream;
- /**
- * This puzzler is called Crossing Streams, try and find out just by looking
- * what the code will print.
- *
- * @author Brian Wiegand (GenuineSounds)
- */
- public class CrossingStreams {
- public static List<String> STRINGS = Arrays.asList("Vadr", "Luke");
- public static void main(String[] args) {
- IntStream ints = IntStream.range(1, 4);
- STRINGS.stream().forEach(string -> {
- ints.forEach(integer -> {
- System.out.print(string + integer + ", ");
- });
- System.out.println();
- });
- }
- }
- /**
- * Multiple Choice
- *
- * What will print:
- * A) Vadr1, Vadr2, Vadr3,
- * Luke1, Luke2, Luke3,
- * B) Vadr1, Vadr2, Vadr3, Vadr4,
- * Luke1, Luke2, Luke3, Luke4,
- * C) Vadr1, Vadr2, Vadr3,
- * D) Vadr1, Vadr2, Vadr3, Vadr4,
- * E) Nothing
- * F) None of the Above
- *
- * Will it throw an exception?
- * A) Yes
- * B) No
- *
- * Explain your answer.
- */
Add Comment
Please, Sign In to add comment