List<String> s = new ArrayList<String>();
List<Object> o = s;
o.add(new Object());
String first = s.get(0); // boom
More Related Contents:
- Java method returns the given variable instead of the result
- Generating all permutations of a given string
- What causes error “No enclosing instance of type Foo is accessible” and how do I fix it?
- How do I fix Dagger 2 error ‘… cannot be provided […]’?
- Placing component on Glass Pane
- How do I get the SharedPreferences from a PreferenceActivity in Android?
- How to read file from relative path in Java project? java.io.File cannot find the path specified
- Can I connect to SQL Server using Windows Authentication from Java EE webapp?
- Surefire is not picking up Junit 5 tests
- Why should wait() always be called inside a loop
- Java double checked locking
- Square root of BigDecimal in Java
- midpoint between two latitude and longitude
- Fast algorithm for searching for substrings in a string
- Comparing strings by their alphabetical order
- Difference between “on-heap” and “off-heap”
- Extracting pairs of words using String.split()
- String replace a Backslash
- How to clone a JPA entity
- How to take a screenshot in Java? [duplicate]
- Java, UTF-8, and Windows console
- HashSet vs LinkedHashSet
- Why does every object in Java implicitly extend java.lang.Object class?
- How to get string name of a method in java?
- Why is it possible to recover from a StackOverflowError?
- How to fix INSTALL_PARSE_FAILED_MANIFEST_MALFORMED in my android application
- Java Label usage [duplicate]
- Java Multithreading concept and join() method
- Can I find out the return value before returning while debugging in Eclipse?
- Async not working on controller’s abstract super class method