Last active
November 19, 2019 10:03
-
-
Save flyakite/832a6b9f48d9725d2c82b8d88a4f8d89 to your computer and use it in GitHub Desktop.
Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.function.BiFunction; | |
public class Main { | |
public static void main(String args[]) | |
{ | |
BiFunction<Integer, Integer, Integer> composite1 = (a, b) -> a + b; | |
composite1 = composite1.andThen(a -> 2 * a); | |
System.out.println("Composite1 = " + composite1.apply(2, 3)); | |
} | |
} | |
// What is the output? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<?> listOfAnyType; | |
List<Object> listOfObject = new ArrayList<Object>(); | |
List<String> listOfString = new ArrayList<String>(); | |
List<Integer> listOfInteger = new ArrayList<Integer>(); | |
// Which of the following assignment is legal? | |
listOfAnyType = listOfString; | |
listOfAnyType = listOfInteger; | |
listOfObjectType = (List<Object>) listOfString; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment